我已经开始使用 Reindex API 将我的一些数据从一个索引重新索引到另一个索引。问题是现在我想停止重建索引过程,即使它还没有完成。我能够看到使用此命令运行的进程:
GET _tasks?detailed=true&actions=*reindex
但是,我该如何阻止呢?
编辑:停止整个集群是不可能的,因为它同时被用于其他目的。
最佳答案
您可以使用 Cancel Task API如果任务是可取消
Any Reindex can be canceled using the Task Cancel API:
POST _tasks/node_id:task_id/_cancel
The task_id can be found using the Tasks API.
Cancelation should happen quickly but might take a few seconds. The Tasks API will continue to list the task until it wakes to cancel itself.
使用下面的命令,获取任务ID并跟随
GET _tasks?detailed=true&actions=*reindex
使用命令给出的 id
并使用 Task API 取消
"tasks" : {
"r1A2WoRbTwKZ516z6NEs5A:36619" : {
"node" : "r1A2WoRbTwKZ516z6NEs5A",
"id" : 36619,
"type" : "transport",
"action" : "indices:data/write/reindex",
.....
}
关于elasticsearch - 如何停止在 Elasticsearch 中重建索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52410416/