简体   繁体   English

Elasticsearch 2.1:如何使用curl通过查询删除

[英]Elasticsearch 2.1: how to delete by query using curl

I have an _index: varnish_logs and _type: varnish 我有一个_index:varnish_logs和_type:varnish

a field having two different values "server" : "india" and "server" : "usa" 具有两个不同值“service”的字段:“india”和“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 ' $ curl -XDELETE'http :// localhost:9200 / _all / _query?q = server:usa '

response: No handler found for uri [] and method [DELETE] 响应:找不到uri []和方法[DELETE]的处理程序

在此输入图像描述 and also tried to delete all the data using query 并尝试使用查询删除所有数据

curl -XDELETE 'http://localhost:9200/varnish_logs/varnish/_query' -d ' { "query" :{ "match_all" : {} } }' 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. Elasticsearch已删除了逐个查询功能。 They have instead replaced it by a plugin with same name. 他们用相同名称的插件替换它。 It is slower than the previous but fixes the problem elasticsearch had previously. 它比以前慢,但修复了elasticsearch之前的问题。

This post from elasticsearch might help. 来自elasticsearch的这篇文章可能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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