Fail _search request with trailing tokens#29428
Merged
jimczi merged 5 commits intoelastic:masterfrom Apr 11, 2018
Merged
Conversation
This change validates that the `_search` request does not have trailing tokens after the main object and fails the request with a parsing exception otherwise. Closes elastic#28995
Collaborator
|
Pinging @elastic/es-search-aggs |
jpountz
approved these changes
Apr 9, 2018
Contributor
jpountz
left a comment
There was a problem hiding this comment.
Looks good. Let's turn the error into a deprecation log on 6.x?
colings86
reviewed
Apr 10, 2018
| } | ||
|
|
||
| public void parseXContent(XContentParser parser) throws IOException { | ||
| parseXContent(parser, false); |
Contributor
There was a problem hiding this comment.
Should this default not be the other way around (pass in true by default)? The only time I think we should allow trailing tokens is in the _msearch API which is a special case. It seems safer to me to check and error on trailing tokens in the default case and then have the _msearch API use the more specialised method below? or is there something I am missing here?
Contributor
Author
There was a problem hiding this comment.
Agreed. I pushed c6a113b to change the default
Contributor
Author
|
Thanks @jpountz @colings86 |
jimczi
added a commit
that referenced
this pull request
Apr 11, 2018
This change removes the check for extra tokens when parsing a source generated by a templated _msearch request. This was added unintentionally in #29428 but the intent of this modification was to validate simple _search request only.
jimczi
added a commit
that referenced
this pull request
Apr 12, 2018
This change validates that the _search request does not have trailing tokens after the main object and prints a deprecation message otherwise. Relates #29428
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change validates that the
_searchrequest does not have trailingtokens after the main object and fails the request with a parsing exception otherwise.
Closes #28995