也可以使用如下DSL
[root@esdbqp bin]# curl -XDELETE "http://localhost:9200/filebeat-2016.01.28/log/_query?pretty=true" -d '
{
"query": {
"term": {
"tags": "multiline"
}
}
}'
{
"took" : 0,
"timed_out" : false,
"_indices" : {
"_all" : {
"found" : 0,
"deleted" : 0,
"missing" : 0,
"failed" : 0
}
},
"failures" : [ ]
}
[root@esdbqp bin]#
我觉得CLI下面这种方法比较麻烦
Tip:
Internally, the query is used to execute an initial scroll request. As hits are pulled from the scroll API, they are passed to the Bulk API for deletion.
执行结果显示正常删除了110条记录
进行查看,剩下4104条,而原来总共4214条,确实是删掉了这么多
[root@esdbqp bin]# curl "http://localhost:9200/filebeat-*/log/_search?pretty=true&q=tags:multiline" | head -n 20
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 12576 100 1 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
{
"took" : 120,
"timed_out" : false,
"_shards" : {
"total" : 165,
"successful" : 165,
"failed" : 0
},
"hits" : {
"total" : 4104,
"max_score" : 9.852164,
"hits" : [ {
"_index" : "filebeat-2016.01.29",
"_type" : "log",
"_id" : "AVKLW366FoV7cO-daoBe",
"_score" : 9.852164,
...
...
...
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。