-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Double backslash in Painless script strings causes a syntax error #22372
Comments
I believe this to be a json encoding issue. Because the script and the error response are both encoded in json the Still, I think it be worth me adding an example of this to painless's docs as we expect lots of folks to use the script inline. And probably to fix up the error message for illegal |
I just tried this locally and |
Hi, thanks for picking this up! I've tested I got a very similar problem in Logstash and actually had to modfiy a filter plugin code to make it accept and parse similar values: logstash-plugins/logstash-filter-elasticsearch#55 |
Let me play with it some more.... |
Looks like a bug, yeah. I reproduced the problem you are having over REST and now in a unit test. I suspect you can work around it for now with |
Thanks for confirming this and taking time to check! |
1. Escape sequences we're working. For example `\\` is now correctly interpreted as `\` instead of `\\`. Same with `\'` being `'` and `\"` being `"`. 2. `'` delimited strings weren't allowed to contain `"`s but it looked like they were intended to support it. Now they do. 3. Improves the error message when the script contains an invalid escape sequence inside a string to include a list of the valid escape sequences. Closes elastic#22372
1. Escape sequences we're working. For example `\\` is now correctly interpreted as `\` instead of `\\`. Same with `\'` being `'` and `\"` being `"`. 2. `'` delimited strings weren't allowed to contain `"`s but it looked like they were intended to support it. Now they do. 3. Improves the error message when the script contains an invalid escape sequence inside a string to include a list of the valid escape sequences. Closes #22372
1. Escape sequences we're working. For example `\\` is now correctly interpreted as `\` instead of `\\`. Same with `\'` being `'` and `\"` being `"`. 2. `'` delimited strings weren't allowed to contain `"`s but it looked like they were intended to support it. Now they do. 3. Improves the error message when the script contains an invalid escape sequence inside a string to include a list of the valid escape sequences. Closes #22372
1. Escape sequences we're working. For example `\\` is now correctly interpreted as `\` instead of `\\`. Same with `\'` being `'` and `\"` being `"`. 2. `'` delimited strings weren't allowed to contain `"`s but it looked like they were intended to support it. Now they do. 3. Improves the error message when the script contains an invalid escape sequence inside a string to include a list of the valid escape sequences. Closes #22372
Elasticsearch version: 5.0.2
Plugins installed: X-Pack
JVM version: 1.8.0_111-b15
OS version: CentOS 7.2.1511
Description of the problem including expected versus actual behavior:
It seems that using double backslash in Painless script string values causes a syntax error. I need to perform a comparison against values with double backslashes. Is there a workaround for this, am I doing something wrong or is it a bug?
NOTE: the original error message below contains double backslashes in '...['\A]...' and '...{ '\Archived' }...', but it gets parsed by GitHub into a single backslash.
Steps to reproduce:
Provide logs (if relevant):
The text was updated successfully, but these errors were encountered: