Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch 2.1: how to delete by query using curl

I have an _index: varnish_logs and _type: varnish

a field having two different values "server" : "india" and "server" : "usa"

Now I want to delete only the records which are in usa.

I tried using

$ curl -XDELETE 'http://localhost:9200/_all/_query?q=server:usa'

response: No handler found for uri [] and method [DELETE]

enter image description here and also tried to delete all the data using query

curl -XDELETE 'http://localhost:9200/varnish_logs/varnish/_query' -d ' { "query" :{ "match_all" : {} } }'

all I get response: found: "false" enter image description here

Please let me know where I'm wrong

like image 760
ck reddy Avatar asked Dec 09 '15 17:12

ck reddy


1 Answers

Elasticsearch has removed the delete-by-query functionality. They have instead replaced it by a plugin with same name. It is slower than the previous but fixes the problem elasticsearch had previously.

This post from elasticsearch might help.

like image 180
manishrw Avatar answered Oct 21 '22 06:10

manishrw