How to stop reindexing in Elasticsearch?
This is the one that worked for me.
POST _tasks/_cancel?nodes=node_id&actions=*reindex
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",
.....
}