【问题标题】:Unable to delete documents from ElasticSearch Index using cURL commands无法使用 cURL 命令从 ElasticSearch 索引中删除文档
【发布时间】:2016-09-12 23:29:07
【问题描述】:

我在 Windows 7 64 位操作系统中设置了 ElasticSearch 索引。这是我的示例文档:

{
      "_index" : "mydocdeleteindex",
      "_type" : "prod",
      "_id" : "AVceQ_DnIBf8JBhpZhxj",
      "_score" : 1.0,
      "_timestamp" : 1473681551591,
      "_source" : {
        "Name" : "My Sample DashBoards",
        "ID" : "forcheckdocdel",
        "Time" : "2016-09-02 07:14:23"
      }
    },

....

我想删除所有带有“名称”的文档:“我的示例仪表板” 我执行了以下 cURL 命令,但没有一个起作用!

curl -XDELETE localhost:9200/mydocdeleteindex/prod/_query -d '{"query":{"_source":{"Name":"My Sample DashBoards"}}}'

curl -XDELETE localhost:9200/mydocdeleteindex/prod/_query -d '{"query":{"term":{"Name":"My Sample DashBoards"}}}'

curl -XDELETE localhost:9200/mydocdeleteindex/prod/_query?q=Name:My Sample DashBoards

curl -XDELETE localhost:9200/mydocdeleteindex/prod/_query?q="Name":"My Sample
DashBoards"

我收到以下错误(按顺序):

1. {"found":false,"_index":"mydocdeleteindex","_type":"prod","_id":"_query","
_version":1,"_shards":{"total":2,"successful":1,"failed":0}}


2. {"found":false,"_index":"mydocdeleteindex","_type":"prod","_id":"_query","
_version":1,"_shards":{"total":2,"successful":1,"failed":0}}


3. {"found":false,"_index":"mydocdeleteindex","_type":"prod","_id":"_query","
_version":1,"_shards":{"total":2,"successful":1,"failed":0}}curl:(6) Could not resolve host: Sample curl: (6) Could not resolve host: DashBoards

4. curl: (52) Empty reply from server 

没有发生任何变化,我看到所有数据都完全可用! :(

【问题讨论】:

  • 您使用的是哪个版本的 Elasticsearch?
  • 这个答案可能会对你有所帮助:stackoverflow.com/questions/39328892/…(提示:你需要安装 delete-by-query 插件)
  • @Val 我使用的是 ES 2.3.5
  • 好的,然后看看我上面的链接答案,它会起作用的。

标签: curl elasticsearch


【解决方案1】:

安装 delete_by_query 插件并尝试相同的命令

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多