简体   繁体   中英

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]

在此输入图像描述 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" 在此输入图像描述

Please let me know where I'm wrong

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM