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/

Executing:

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

{"ok":true,"_indices":{"foo":{"_shards":{"total":5,"successful":5,"failed":0}}}}%

yet, querying:

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

gives me:

{"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0}

with the 5 records printed...

I have tried running:

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

but still results are returned?

Answers


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


About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.