我在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"
}
},
....
我想删除所有带有“名称”的文件:“我的样本DashBoards” 我执行了下面的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
没有变化,我看到所有数据都完全可用! :(
答案 0 :(得分:1)
安装delete_by_query插件并尝试相同的命令