Elasticsearch 2.1:如何使用curl通过查询进行删除 [英] Elasticsearch 2.1: how to delete by query using curl

查看:827
本文介绍了Elasticsearch 2.1:如何使用curl通过查询进行删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个_index:varnish_logs和_type:varnish



有两个不同值的字段server:india和server:usa / p>

现在我只想删除美国的记录。



我尝试使用



$ curl -XDELETE'
并尝试使用查询删除所有数据



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



all我得到回应:找到:false



请让我知道我在哪里错误

解决方案

Elasticsearch已删除按查询删除功能。他们已经替换为一个具有相同名称的插件。它比以前慢,但修复了以前弹性搜索的问题。



post from elasticsearch可能会有帮助。


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.

这篇关于Elasticsearch 2.1:如何使用curl通过查询进行删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆