REST APIs —— Document APIs —— Delete by query API
https://www.elastic.co/guide/en/elasticsearch/reference/8.8/docs-delete-by-query.html
Deletes documents that match the specified query.
删除与指定查询匹配的文档。
curl -X POST "localhost:9200/my-index-000001/_delete_by_query?pretty" -H 'Content-Type: application/json' -d' { "query": { "match": { "user.id": "elkbee" } } }'
1、Request(请求)
https://www.elastic.co/guide/en/elasticsearch/reference/8.8/docs-delete-by-query.html#docs-delete-by-query-api-request
POST //_delete_by_query POST//_delete_by_query
2、Prerequisites(先决条件)
https://www.elastic.co/guide/en/elasticsearch/reference/8.8/docs-delete-by-query.html#docs-delete-by-query-api-prereqs
If the Elasticsearch security features are enabled, you must have the following index privileges for the target data stream, index, or alias:
如果启用了 Elasticsearch 安全特性,您必须对目标数据流、索引或别名拥有以下索引特权:
-
read
- 读
delete
orwrite
- 删除或写入