Elasticsearch 2.3 - 通过查询删除文档 [英] Elasticsearch 2.3 - delete documents by query
问题描述
我参考这些文档:
https://www.elastic.co/guide/en/elasticsearch/plugins/current/delete-by-query -usage.html
请求
code> DELETE / monitors / monitor / _query
{
term:{ProcessName:myProcName}
}
回应
{
found:false,
_index:monitor,
_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:monitor,
_type:monitor,
_id :_query,
_version:1,
_shards:{
total:2,
success:1,
:0
}
}
p>您获得的输出意味着您尚未安装默认情况下未安装的逐个查询插件插件。
做第一个,重新启动你的节点,然后它将工作
bin / plugin install通过查询删除
I'm using elasticsearch 2.3 & Sense and trying to delete documents by query.
I refer to these docs: https://www.elastic.co/guide/en/elasticsearch/plugins/current/delete-by-query-usage.html
Request
DELETE /monitors/monitor/_query
{
"term": { "ProcessName" : "myProcName" }
}
Response
{
"found": false,
"_index": "monitors",
"_type": "monitor",
"_id": "_query",
"_version": 11,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
}
}
As you can see, i'm not getting any results even though I have ProcessName named "myProcName".
Response also tells that the engine looks for _id
equals to _query
.
EDIT 1: Even when sending request:
DELETE /monitors/monitor/_query
{
"query": {
"term": { "ProcessName" : "tibapp_qflowfile" }
}
}
I'm getting response:
{
"found": false,
"_index": "monitors",
"_type": "monitor",
"_id": "_query",
"_version": 1,
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
}
}
The output you're getting means that you haven't installed the delete-by-query plugin, which isn't installed by default.
Do that first, restart your node and it will work afterwards
bin/plugin install delete-by-query
这篇关于Elasticsearch 2.3 - 通过查询删除文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!