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

ES not throwing parse exception `ids` query double-nested array #7686

Closed
teckays opened this issue Sep 11, 2014 · 4 comments · Fixed by #7945

Comments

@teckays
Copy link

commented Sep 11, 2014

[2014-09-11 11:47:51,946][DEBUG][index.search.slowlog.query] [n020] [index][3] took[3.1s], took_millis[3141], types[type], stats[], search_type[QUERY_THEN_FETCH], total_shards[5], source[{"size":12,"from":0,"sort":{"ats":"desc"},"query":{"filtered":{"query":{"query_string":{"query":"ten words string","fields":["title","tags"],"default_operator":"OR"}},"filter":{"bool":{"must":[{"range":{"ats":{"lte":1410428944}}},{"terms":{"aid":[27]}}],"must_not":[{"ids":{"values":[["ten-words-dash-separated-string"]]}}]}}}}}], extra_source[]

@cfontes

This comment has been minimized.

Copy link
Contributor

commented Sep 18, 2014

Could you provide the REST command you used?
It would make it easier for meto test and understand the issue.

@teckays

This comment has been minimized.

Copy link
Author

commented Sep 18, 2014

It was a simple Search query with params as query.

@clintongormley

This comment has been minimized.

Copy link
Member

commented Sep 25, 2014

This is the pertinent clause:

{"ids":{"values":[["ten-words-dash-separated-string"]]}

Note the double array

@teckays

This comment has been minimized.

Copy link
Author

commented Sep 26, 2014

Yes, I mentioned the double array which is a bug from my script, however as @dakrone pointed out, ES should throw a parsing error in this case which it did not.

@dakrone dakrone self-assigned this Oct 1, 2014

@dakrone dakrone removed the help wanted label Oct 1, 2014

dakrone added a commit to dakrone/elasticsearch that referenced this issue Oct 1, 2014
Be stricter parsing ids for ids query
Adds a check to make sure that all ids in the query are either strings
or numbers. This is to prevent the case where a user accidentally
specifies:

"ids": [["1", "2"]]

(note the double array)

With this change, an exception will be thrown since the second "[" is
not a string or number, it is a Token.START_ARRAY.

Fixes elastic#7686

@dakrone dakrone closed this in #7945 Oct 1, 2014

dakrone added a commit that referenced this issue Oct 1, 2014
Be stricter parsing ids for ids query
Adds a check to make sure that all ids in the query are either strings
or numbers. This is to prevent the case where a user accidentally
specifies:

"ids": [["1", "2"]]

(note the double array)

With this change, an exception will be thrown since the second "[" is
not a string or number, it is a Token.START_ARRAY.

Fixes #7686
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.