Elasticsearch delete-by-query returns success but records persist?

I am attempting to delete records from elasticsearch using the delete by query api: http://www.elasticsearch.org/guide/reference/api/delete-by-query/


curl -XDELETE localhost:4040/search/foo/_query -d '{ "term" : {"record id" : "0f9eaa6f-90bb-4dee-9ecb-78a5d04719c0"}}' results in:


yet, querying:

curl -XGET localhost:4040/search/foo/_search -d '{ "query" : {"match" : {"record id" : "0f9eaa6f-90bb-4dee-9ecb-78a5d04719c0"}}}'

gives me:


with the 5 records printed...

I have tried running:

curl -XGET localhost:4040/search/foo/_refresh

but still results are returned?


You are deleting using the term query and you are searching using the match query. These are two different queries. The term query doesn't analyze the supplied query term while the match does. So these two queries may produce different results depending on how your record id field is analyzed.

Need Your Help