Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor(?) scripting bug(?): (caching-related?) odd behavior when changing languages for the same script code #1150

Closed
Alex-Ikanow opened this issue Jul 22, 2011 · 1 comment

Comments

@Alex-Ikanow
Copy link

(Unlike the other scripting issues I've been reporting, this one is not causing my any problems at all, I just wanted to report this to get fixed during some idle moment - I think just adding "lang" to the cache key should fix it?)

I noticed this when trying to workaround the mvel bugs reported elsehwere (cough-hint-cough j/k). Here's the steps:

1] Run an mvel script that doesn't work in JS:

"script_fields":{
"test1":{
"script":"toRadians(0)",
}
},

2] Switch the language to JS

"script_fields":{
"test1":{
"script":"toRadians(0)",
"lang":"js"
}
},

This returns exactly the same response

3] Now make a trivial change to the script:

"script_fields":{
"test1":{
"script":"0+toRadians(0)",
"lang":"js"
}
},

This fails with the expected "EcmaError[ReferenceError: "toRadians" is not defined. (Script3.js#1)]" error

So it looks like in step [2] it's just re-submitted the original cached? mvel query

4] if I now change lang to be mvel, ie same script:

"script_fields":{
"test1":{
"script":"0+toRadians(0)",
"lang":"mvel"
}
},

It continues to fail, ie the (erroring) script has been cached.

@kimchy
Copy link
Member

kimchy commented Jul 30, 2011

Yea, thats exactly what happens, a script is only cached based on its content, and not the lang as well...

@kimchy kimchy closed this as completed in 146a6d3 Jul 30, 2011
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
jev001 pushed a commit to jev001/elasticsearch that referenced this issue Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants