【问题标题】:Elasticsearch 2.3 - delete documents by queryElasticsearch 2.3 - 通过查询删除文档
【发布时间】:2016-08-02 12:00:12
【问题描述】:

我正在使用 elasticsearch 2.3 和 Sense 并尝试通过查询删除文档。

我参考这些文档: 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
  }
}

如您所见,即使我的 ProcessName 名为“myProcName”,我也没有得到任何结果。 响应还告诉引擎寻找_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
  }
}

【问题讨论】:

  • 您的查询需要包含在"query": {} 中,即{"query":{"term": { "ProcessName" : "myProcName" }}}
  • @Val 嗨,伙计。我已经编辑了我的问题
  • 运行curl 'localhost:9200/_cat/plugins?v'会得到什么?
  • @Val 我得到:“名称组件版本类型 url”

标签: elasticsearch


【解决方案1】:

你得到的输出意味着你没有安装 delete-by-query 插件,默认情况下没有安装。

Do that first,重启你的节点,之后就可以工作了

bin/plugin install delete-by-query

【讨论】:

  • 我尝试下载为文件,并通过命令行安装。我收到一个错误,即使文件没有损坏:-> 从文件安装:/C:/delete-by-query-2.3.1.zip... 正在尝试文件:/C:/delete-by- query-2.3.1.zip ... 正在下载 .DONE 验证文件:/C:/delete-by-query-2.3.1.zip 校验和(如果可用)... 注意:无法验证下载插件的校验和(无法找到.sha1 或 .md5 文件进行验证)错误:无效条目大小(预期为 0,但得到 30926 字节)
  • 奇怪,你确定能打开你下载的那个ZIP吗?
  • 当然,我什至提取了文件:delete-by-query-2.3.1.jar plugin-descriptor.properties
【解决方案2】:

仅供参考 - 插件 [delete-by-query] 与 Elasticsearch [2.3.5] 不兼容。专为 [2.3.4] 版本设计

【讨论】:

    猜你喜欢
    • 2015-01-04
    • 2016-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多