简体   繁体   English

Elasticsearch使用搜索查询删除结果

[英]Elasticsearch Use Search Query for Deleting the results

Below is a boolean search query. 下面是一个布尔搜索查询。 I want to delete all the document results matched by this query. 我想删除此查询匹配的所有文档结果。 How to do that? 怎么做?

I tried delete by query interface (new api is here ) 我尝试通过查询界面删除 (新的api在这里

CURL -XDELETE /index/doc/_query/routing=abc -d '{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "_ua_family": "Firefox"
          }
        },
        {
          "range": {
            "created_at": {
              "gte": 1352147225,
              "lte": 1352752025
            }
          }
        }
      ],
      "should": [],
      "must_not": []
    }
  },
  "sort": {
    "created_at": "desc"
  },
  "facets": {
    "_message": {
      "histogram": {
        "field": "created_at",
        "interval": 3600
      }
    }
  },
  "from": 0,
  "size": 10
}'

elasticsearch response contains elasticsearch响应包含

{
  "_shards": {
    "total": 1,
    "successful": 0,
    "failed": 1
  }
}

Got it working, the query should be 得到它的工作,查询应该是

{
    "bool": {
        "must": [{
            "term": {
                "_ua_family": "Firefox"
            }
        }, {
            "range": {
                "created_at": {
                    "gte": 1352147225,
                    "lte": 1352752025
                }
            }
        }],
        "should": [],
        "must_not": []
    }
}

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

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