Kibana Batch Reindex API - How to cancel un-started queued tasks?

I am running Elastic/Kibana 7.17.3. I am using the Upgrade Assistant APIs in Kibana to reindex indices from v6 to v7 in preparation for upgrading to v8. I am able to start the batch reindex process which enqueues tasks to perform the reindexing work. We have a limited maintenance window and are likely not to be able to complete all the reindexing jobs within that window. I would like to be able to cancel the reindex tasks that have not yet begun when my maintenance window is over. Is it possible to cancel the queued reindex tasks for indices that have not yet started the reindex process (status and lastCompletedStep are both 0)? When I attempt this through the cancel api, I get a 400 Bad Request error stating:

Reindex operation is not currently waiting for reindex task to complete.

It appears that this api can only be used once reindexing has started (lastCompletedStep is >= 40).

Is there a way to clear the queue of work that has not yet started?

Hi @mscully welcome to our community!

@alisongoryachev can you help answer how the cancel api works? Thanks.

Hi @mscully!

The Upgrade Assistant APIs in Kibana are considered experimental. Unfortunately, the current implementation of the cancel API does not support canceling reindex operations that have not yet started.

That said, the reindex operations are stored in a saved object under the type upgrade-assistant-reindex-operation. I suppose you could try calling the saved objects API, find the indices that have not yet started the reindex operation yet, and then remove them from the saved object. However, I have not tested this and would proceed with caution.

Alternatively, you might consider using Elasticsearch APIs directly. These docs provide some information on how to set up a script to batch reindex. Then, you would need to use the cancel tasks API to cancel any running reindex tasks.

Hope that helps!

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.