elasticsearch - 通过查询从 Elasticsearch 中删除记录

标签 elasticsearch

我正在尝试从 Elasticsearch 中删除特定日期记录。我的查询如下:

curl -XDELETE 'http://localhost:9200/twitter/twit/_query' -d '
{
    "filter" : {
            "range" : {
                "date_time" : { "from" : "2012-10-01 00:00:01", "to" : "2013-05-01 11:59:59"}
            }
        }
}'

但它并没有删除任何记录。所以它是正确的还是有一些其他的方法来删除记录。

最佳答案

1.0之前,delete by query不使用过滤器。语法直接转到搜索 API 中的“查询” block 。您需要使用 range query相反。

curl -XDELETE 'http://localhost:9200/twitter/twit/_query' -d '
{
    "range" : {
        "date_time" : { "from" : "2012-10-01 00:00:01", "to" : "2013-05-01 11:59:59"}
    }
}'

关于elasticsearch - 通过查询从 Elasticsearch 中删除记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17676022/

相关文章:

php - 术语中的多重条件或条件中的所有条件都匹配

elasticsearch - Elasticsearch地理空间搜索,索引设置问题

python - Elasticsearch 返回搜索到的词

c# - 在 Elasticsearch 中将英语分析器添加到类型

javascript - 如何验证 JavaScript 中的正则表达式?

node.js - 来自nodejs + elasrticsearch github repo的此错误消息 "Error: Cannot find module ' ../models'”的原因是什么

elasticsearch - Elasticsearch与Cassandra集成

elasticsearch - 来自多个字段的集合中的随机自由文本搜索Elastic Search

elasticsearch - logstash kv {}过滤器插件如何工作?

elasticsearch - 检索Copy_to/Stored字段