简体   繁体   中英

Unable to delete documents from ElasticSearch Index using cURL commands

I have setup an ElasticSearch Index in Windows 7 64 Bit OS. Here are is my sample document :

{
      "_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"
      }
    },

....

I would like to delete all the documents with "Name":"My Sample DashBoards" I executed the below cURL commands and none of it worked!

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"

I get the below errors (in order):

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 

No change happens and I see all the data perfectly available! :(

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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