通过查询从 Elasticsearch 中删除记录 [英] Delete records from Elasticsearch by query

查看:44
本文介绍了通过查询从 Elasticsearch 中删除记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to delete specific date records from Elasticsearch. My query is the following:

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"}
            }
        }
}'

但它不会删除任何记录.所以是正确的还是有其他删除记录的方法.

but it is not deleting any records. so it is correct one or are there some other methods to delete records.

推荐答案

1.0 之前,按查询删除不使用过滤器.语法直接指向搜索 API 中的查询"块.您需要改用范围查询.

Prior to 1.0, the delete by query does not use filters. The syntax goes directly to what is the "query" block in the search API. You need to use the range query instead.

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 中删除记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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