Elasticsearch Delete By Query Plugin6

2022-01-20 11:57:36 浏览数 (1)

结果显示成功删除了4104个记录

进行查看

代码语言:javascript复制
[root@esdbqp bin]# curl "http://localhost:9200/filebeat-*/log/_search?pretty=true&q=tags:multiline"
{
  "took" : 43,
  "timed_out" : false,
  "_shards" : {
    "total" : 165,
    "successful" : 165,
    "failed" : 0
  },
  "hits" : {
    "total" : 0,
    "max_score" : null,
    "hits" : [ ]
  }
}
[root@esdbqp bin]# 

已经没有被标记为 multiline 的记录了



命令汇总

  • curl "http://localhost:9200/filebeat-*/_search?pretty=true&q=tags:multiline"
  • /usr/share/elasticsearch/bin/plugin install delete-by-query
  • /usr/share/elasticsearch/bin/plugin list
  • /etc/init.d/elasticsearch restart
  • curl -XDELETE "http://localhost:9200/filebeat-2016.01.28/log/_query?pretty=true&q=tags:multiline"
  • curl -XDELETE "http://localhost:9200/filebeat-2016.01.28/log/_query?pretty=true" -d '
  • curl -XDELETE "http://localhost:9200/filebeat-*/log/_query?pretty=true&q=tags:multiline"
  • curl "http://localhost:9200/filebeat-*/log/_search?pretty=true&q=tags:multiline"
  • /usr/share/elasticsearch/bin/plugin remove delete-by-query

删除插件

代码语言:javascript复制
[root@esdbqp bin]# /usr/share/elasticsearch/bin/plugin list
Installed plugins in /usr/share/elasticsearch/plugins:
    - delete-by-query
[root@esdbqp bin]# /usr/share/elasticsearch/bin/plugin remove delete-by-query
-> Removing delete-by-query...
Removed delete-by-query
[root@esdbqp bin]# /usr/share/elasticsearch/bin/plugin list
Installed plugins in /usr/share/elasticsearch/plugins:
    - No plugin detected
[root@esdbqp bin]# /etc/init.d/elasticsearch restart 
Stopping elasticsearch:                                    [  OK  ]
Starting elasticsearch:                                    [  OK  ]
[root@esdbqp bin]# 

Note: 一定要重启服务,才能生效


原文地址

0 人点赞