Mpdreamz/NEST — Issue #18: DeleteByQuery delete all items in index
Author: y-vasilyev
Created: 2012-02-17 07:13:36+00:00
State: open

Following code delete all records in index, not only with id = "1404.0.0"

var indexedData = new[] { "1404.0.0" };

string query = @" { ""query"" : {
""terms"" : { ""id"" : [" + string.Join(",", indexedData.Select(x => @"""" + x + @"""")) + @"] }
} }";

var status = client.DeleteByQuery(query);

I captured following request

DELETE http://10.54.xx.xx:9200/test_create/address_search/?pretty=true
HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: 10.54.18.47:9200
Content-Length: 64
Expect: 100-continue
Connection: Keep-Alive

{ "query" : {
"terms" : { "id" : ["1404.0.0"] }
} }

On elastic search forum I got answer that
I should replace :
http://10.54.xx.xx:9200/test_create/address_search/?pretty=true
by : http://10.54.xx.xx:9200/test_create/address_search/_query?pretty=true

More info here
https://groups.google.com/forum/?fromgroups#!topic/elasticsearch/zdKU9BiUwj0

Thanks!