-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
Disabled parent/child queries in the delete by query api. #5916
Disabled parent/child queries in the delete by query api. #5916
Conversation
@@ -54,6 +54,9 @@ public TopChildrenQueryParser() { | |||
|
|||
@Override | |||
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException { |
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.
I think you should generalize this in a utils methods like
public void ensureNotDeleteByQuery(QueryParser parser, QueryParseContext parseContext) {
if ("delete_by_query".equals(SearchContext.current().source())) {
throw new QueryParsingException(parseContext.index(), "[" + parser.names()[0] + "] unsupported in delete_by_query api");
}
}
that way you only need to have that logic in one place....
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.
Agreed! I'll change that.
left one comment - look close :) thanks! |
Updated the PR to move the delete by query api usage checking into one place. |
It's not super urgent but maybe we should move this method into a |
Updated the PR and moved the method to |
…roperly implemented and could lead to a shard being failed and not able to recover. Closes elastic#5828
* Ensures that the query parsing wasn't invoked via the delete by query api. | ||
*/ | ||
public static void ensureNotDeleteByQuery(String name, QueryParseContext parseContext) { | ||
if ("delete_by_query".equals(SearchContext.current().source())) { |
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.
can we use a constant here? and use it both here and in the delete by query action?
lets a small comment, LGTM otherwise. |
Pushed via: 17a5575 |
It wasn't properly implemented and could lead to a shard being failed and not able to recover. Closes elastic#5828 elastic#5916
It wasn't properly implemented and could lead to a shard being failed and not able to recover. Closes elastic#5828 elastic#5916
PR for #5828