elasticsearch - 如何停止在 Elasticsearch 中重建索引?

标签 elasticsearch

我已经开始使用 Reindex API 将我的一些数据从一个索引重新索引到另一个索引。问题是现在我想停止重建索引过程,即使它还没有完成。我能够看到使用此命令运行的进程:

GET _tasks?detailed=true&actions=*reindex

但是,我该如何阻止呢?

编辑:停止整个集群是不可能的,因为它同时被用于其他目的。

最佳答案

您可以使用 Cancel Task API如果任务是可取消

Quoting from documentation

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/

相关文章:

symfony - FOSElasticaBundle问题在cron作业中运行填充命令

elasticsearch - Elasticsearch查询:对两个字段进行范围查询,但一个是可选字段

json - 无法通过Logstash将JSON数据导入Elastic

elasticsearch - ELK Watcher对嵌套存储桶使用数组比较

Elasticsearch 错误 : MapperParsingException failed to parse

elasticsearch - 即使清除了$ SONAR_HOME/data/es文件夹,Sonarqube也无法启动

mapping - ElasticSearch:多字段 “upgrade”产生错误:

node.js - 我的Node.js Web服务上的回调 hell 发送到elasticsearch

java - 使用 found 通过 SSL 连接到 elasticsearch

elasticsearch - 许多必须与multi_match