【问题标题】:elasticsearch deletebyquery return only not foundelasticsearch deletebyquery 仅返回未找到
【发布时间】:2016-03-05 13:11:42
【问题描述】:

我尝试使用https://www.npmjs.com/package/elasticsearch-deletebyquery 通过查询删除文档。但是所有时间都返回给我没有找到。我的用法:

client.deleteByQuery({
  index: index,
  type: type,
  body: {
    query: {
      range: {
        timeStamp: {
          gte: "2016-03-05",
          lt: "2016-03-06"
        }
      }
    }
  }
});

返回时我有:

Elasticsearch TRACE: 2016-03-05T11:48:52Z
  -> DELETE ... 9200/amazontest/pageRanktest/_query
  {
    "query": {
      "range": {
        "timeStamp": {
          "gte": "2016-03-05",
          "lt": "2016-03-06"
        }
      }
    }
  }
  <- 404
  {
    "found": false,
    "_index": "amazontest",
    "_type": "pageRanktest",
    "_id": "_query"

怎么了?谁能帮帮我吗?

【问题讨论】:

    标签: javascript elasticsearch elasticsearch-plugin


    【解决方案1】:

    从 ES 2.0 开始,按查询删除功能为 removed from the core,现在可作为插件使用。您可以在所有 ES 节点上安装 delete-by-query 插件,以添加对通过查询删除文档的支持。

    像这样安装插件:

    bin/plugin install delete-by-query
    

    然后您可以运行您的代码而不会收到 404。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-20
      • 1970-01-01
      • 2017-02-05
      • 2020-09-29
      • 1970-01-01
      相关资源
      最近更新 更多