从 Elastic GET API 获取顶级 xyz

Get top xyz from Elastic GET API

我需要从 Elastic Index 中删除文档。我试过跟随,但由于文档的大小,它会超时。

POST my-index-000001/_delete_by_query?conflicts=proceed
{
  "query": {
    "match_all": {}
  }
}

因此,我正在考虑获取前 5000 条记录 ids 并发送批量删除查询。谁能帮我从 elastic API 中获取前 5000 个 ID(无需检索整个文档对象)?或者有没有其他方法可以处理这种情况?

尝试添加 wait_for_completion=false

from here

    POST my-index-000001/_delete_by_query?conflicts=proceed&wait_for_completion=false
     {
      "query": {
      "match_all": {}
     }
   }

If the request contains wait_for_completion=false, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at .tasks/task/${taskId}. When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space.

运行 GET /_tasks/your-task-id 查看其状态