如何删除某个索引下的所有数据?
$ curl -X POST "localhost:9200/${index}/${tpye}/_delete_by_query?pretty" \
-H 'Content-Type:application/json' \
-d '{
"query": {
"match_all":{}
}
}'
删除所有数据:(注意请求方式是Post,只删除数据,不删除表结构)
$ curl -X POST "xx.xx.xx.xx:9200/${index}/_delete_by_query?pretty" \
-H 'Content-Type:application/json' \
-d '{
"query": {
"match_all":{}
}
}'
参考
ES删除全部数据的方法(Delete By Query)
https://blog.csdn.net/weixin_39198406/article/details/83016471
ElasticSearch 清空index数据的方法
https://www.cxyzjd.com/article/DPnice/80251696
ElasticSearch 定时批量删除N天前的数据
https://blog.csdn.net/geekswg/article/details/107097322
ElasticSearch 清空index数据的方法 _delete_by_query
https://blog.csdn.net/DPnice/article/details/80251696
Document APIs » Delete by query API
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html