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

The parent option is ignored in delete requests #3257

Closed
martijnvg opened this Issue Jun 28, 2013 · 0 comments

Comments

Projects
None yet
1 participant
@martijnvg
Copy link
Member

martijnvg commented Jun 28, 2013

The parent option is ignored in the delete api (rest only) and for delete actions in the bulk api.
This bug occurs in the case that the _parent field enabled in a mapping, and only the parent option is used. This results in a situation that documents are deleted even if the specified parent value is incorrect.

In the case that routing is required and no routing is specified for a delete request, then the delete is executed on all shards. The also applies when the _parent field is configured on a mapping for a type the delete is executed. The parent id also acts as a routing value.

Current work around is to not use the parent option and just use the routing option, which has the same effect.

Test case:

curl -XDELETE 'localhost:9200/test%2A?pretty=1'

curl -XPUT 'localhost:9200/test_1?pretty=1'  -d '
{
   "mappings" : {
      "test" : {
         "_parent" : {
            "type" : "foo"
         }
      }
   }
}
'

curl -XGET 'localhost:9200/_cluster/health?wait_for_status=yellow&pretty=1'

curl -XPUT 'localhost:9200/test_1/test/1?parent=3&pretty=1'  -d '
{
   "foo" : "bar"
}
'

curl -XDELETE 'localhost:9200/test_1/test/1?parent=2&pretty=1'

# {
#    "ok" : true,
#    "_index" : "test_1",
#    "_id" : "1",
#    "_type" : "test",
#    "found" : true,
#    "_version" : 2
# }

curl -XDELETE 'localhost:9200/test_1/test/1?parent=3&pretty=1'

# {
#    "ok" : true,
#    "_index" : "test_1",
#    "_id" : "1",
#    "_type" : "test",
#    "found" : false,
#    "_version" : 0
# }

@ghost ghost assigned martijnvg Jun 28, 2013

@martijnvg martijnvg closed this in f878075 Jun 28, 2013

martijnvg added a commit that referenced this issue Jun 28, 2013

Fixes the issue that the `parent` option was ignored for delete reque…
…sts.

The `parent` option was ignored in the delete api (rest only) and for delete actions in the bulk api.
This bug occurred in the case that the _parent field is enabled, and only the parent option was used. This resulted in a situation that documents are deleted even if the specified parent value is incorrect.

Closes #3257

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015

Fixes the issue that the `parent` option was ignored for delete reque…
…sts.

The `parent` option was ignored in the delete api (rest only) and for delete actions in the bulk api.
This bug occurred in the case that the _parent field is enabled, and only the parent option was used. This resulted in a situation that documents are deleted even if the specified parent value is incorrect.

Closes elastic#3257
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.