-
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
Throw exception when multiple field names are provided as part of query short syntax #19871
Throw exception when multiple field names are provided as part of query short syntax #19871
Conversation
… its short version
…elds in its short version
… its short version
@tlrx this should address your comment from #19791 (comment) . Can you have a look please? |
@@ -309,6 +309,10 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep | |||
} | |||
} | |||
} else { | |||
if (fieldName != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be a method in AbstractQueryBuilder
? Something like throwParseExceptionOnMultipleFields(String queryName, String fieldName, String currentName)
?
Left a comment, thanks for doing this @javanna ! |
…ields are provided
…provided in a query that support one field only This makes sure that error messages are unified, and makes us save a few lines of code too.
…ith all other queries
@tlrx I pushed some new commits that should address your comment |
LGTM, thanks! |
With #19791 we made sure that our query parsers throw error whenever they encounter multiple field names if only one is required. This PR covers the same situation for queries short syntax.