简体   繁体   中英

How to stop reindexing in Elasticsearch?

I've started reindexing some of my data from one index to another using the Reindex API. The problem is that now I want to stop the reindexing process, even though it has not finished. I'm able to see the process running with this command:

GET _tasks?detailed=true&actions=*reindex

But, how can I stop it?

EDIT: Stopping the whole cluster is not a possibility because it is being used for other purposes at the same time.

You can use the Cancel Task API if the Task is cancellable

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.


Using the command below, get the task ID and follow

GET _tasks?detailed=true&actions=*reindex

Use the id given out from the command and cancel using the Task API

 "tasks" : {
    "r1A2WoRbTwKZ516z6NEs5A:36619" : {
      "node" : "r1A2WoRbTwKZ516z6NEs5A",
      "id" : 36619,
      "type" : "transport",
      "action" : "indices:data/write/reindex",
      .....
}

这是对我有用的那个。

POST _tasks/_cancel?nodes=node_id&actions=*reindex

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM