Skip to content

Instantly share code, notes, and snippets.

@forste
Created May 25, 2012 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save forste/2788743 to your computer and use it in GitHub Desktop.
Save forste/2788743 to your computer and use it in GitHub Desktop.
elasticsearch - Delete By Query API - data option does not delete data
elasticsearch 0.19.0
java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10.2)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
//shows 32 documents
curl -XGET 'http://localhost:9200/contacts/linkedin/_search?pretty=true' -d '{
query:
{ bool:
{ should: [ { matchAll: {} } ],
must: [ { text: { user: { query: "stephanfortelny@gmail.com", operator: "and" } } } ] } }
}'
//does not work yet
curl -XDELETE 'http://localhost:9200/contacts/linkedin/_query' -d '{
"term" : { "user" : "stephanfortelny@gmail.com" }
}'
{"ok":true,"_indices":{"contacts":{"_shards":{"total":5,"successful":5,"failed":0}}}}
//stills shows same 32 documents
curl -XGET 'http://localhost:9200/contacts/linkedin/_search?pretty=true' -d '{
query:
{ bool:
{ should: [ { matchAll: {} } ],
must: [ { text: { user: { query: "stephanfortelny@gmail.com", operator: "and" } } } ] } }
}'
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 32,
"max_score" : 1.288314,
"hits" : [ {
"_index" : "contacts",
"_type" : "linkedin",
"_id" : "RonYEGYKRlS4yUgSNx8INw"
...
}
//works
curl -XDELETE 'http://localhost:9200/contacts/linkedin/_query?q=user:stephanfortelny@gmail.com'
{"ok":true,"_indices":{"contacts":{"_shards":{"total":5,"successful":5,"failed":0}}}}
//documents get deleted
curl -XGET 'http://localhost:9200/contacts/linkedin/_search?pretty=true' -d '{
query:
{ bool:
{ should: [ { matchAll: {} } ],
must: [ { text: { user: { query: "stephanfortelny@gmail.com", operator: "and" } } } ] } }
}'
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment