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

Disabled parent/child queries in the delete by query api. #5916

Conversation

martijnvg
Copy link
Member

PR for #5828

@@ -54,6 +54,9 @@ public TopChildrenQueryParser() {

@Override
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
Copy link
Contributor

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....

Copy link
Member Author

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.

@s1monw
Copy link
Contributor

s1monw commented Apr 23, 2014

left one comment - look close :) thanks!

@martijnvg
Copy link
Member Author

Updated the PR to move the delete by query api usage checking into one place.

@s1monw
Copy link
Contributor

s1monw commented Apr 24, 2014

It's not super urgent but maybe we should move this method into a QueryParserUtils class?

@martijnvg
Copy link
Member Author

Updated the PR and moved the method to QueryParserUtils util class.

* 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())) {
Copy link
Member

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?

@kimchy
Copy link
Member

kimchy commented Apr 28, 2014

lets a small comment, LGTM otherwise.

@martijnvg martijnvg added v2.0.0 and removed review labels Apr 28, 2014
martijnvg added a commit that referenced this pull request Apr 28, 2014
It wasn't properly implemented and could lead to a shard being failed and not able to recover.

Closes #5828 #5916
martijnvg added a commit that referenced this pull request Apr 28, 2014
It wasn't properly implemented and could lead to a shard being failed and not able to recover.

Closes #5828 #5916
martijnvg added a commit that referenced this pull request Apr 28, 2014
It wasn't properly implemented and could lead to a shard being failed and not able to recover.

Closes #5828 #5916
martijnvg added a commit that referenced this pull request Apr 28, 2014
It wasn't properly implemented and could lead to a shard being failed and not able to recover.

Closes #5828 #5916
@martijnvg
Copy link
Member Author

Pushed via: 17a5575

mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
It wasn't properly implemented and could lead to a shard being failed and not able to recover.

Closes elastic#5828 elastic#5916
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
It wasn't properly implemented and could lead to a shard being failed and not able to recover.

Closes elastic#5828 elastic#5916
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Parent/Child labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker >bug :Search/Search Search-related issues that do not fall into other categories v1.0.4 v1.1.2 v1.2.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants