Elasticsearch 2.3 - 通过查询删除文档

时间:2016-04-12 04:35:08

标签: elasticsearch

我正在使用elasticsearch 2.3&感觉并尝试通过查询删除文档。

我指的是这些文档: https://www.elastic.co/guide/en/elasticsearch/plugins/current/delete-by-query-usage.html

请求

DELETE /monitors/monitor/_query
{
  "term": { "ProcessName" : "myProcName" }
}

响应

{
  "found": false,
  "_index": "monitors",
  "_type": "monitor",
  "_id": "_query",
  "_version": 11,
  "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
  }
}

正如你所看到的,即使我有名为“myProcName”的ProcessName,我也没有得到任何结果。 响应还告诉引擎查找_id等于_query

编辑1: 即使发送请求:

DELETE /monitors/monitor/_query
{
  "query": {
    "term": { "ProcessName" : "tibapp_qflowfile" }
  }
}

我收到了回复:

{
  "found": false,
  "_index": "monitors",
  "_type": "monitor",
  "_id": "_query",
  "_version": 1,
  "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
  }
}

2 个答案:

答案 0 :(得分:2)

您获得的输出意味着您尚未安装delete-by-query插件,默认情况下不会安装该插件。

Do that first,重新启动您的节点,之后它将继续

bin/plugin install delete-by-query

答案 1 :(得分:1)

仅供参考 - 插件[按查询删除]与Elasticsearch [2.3.5]不兼容。是为版本[2.3.4]而设计的