如何查看 ElasticSearch 的 Reindex 的进度 API

How to check progress of ElasticSearch's Reindex API

我正在尝试通过 Reindex API 从远程 ES 2.4 集群执行重建索引操作。哪个工作是将索引的1亿多文档转移到最新版本的elasticsearch。

对于测试用例,我正在小数据集上尝试它,但我面临以下问题。

问题:

  1. 看不到多少文档的脚本进度 已转移,还剩多少。

  2. 万一失败,我该如何恢复脚本而不是 从 0 重新开始。

您可以使用Task management API to know the status of reindex, As suggested in the official doc of reindex API。来自同一个文档

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/_doc/${taskId}. When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space.