databaseelasticsearchnosqlopensearch

How do I wait for Elasticsearch to finish cloning an index?


I'm doing Elasticsearch reindexing as a multistep process using the JavaScript client library:

I need to wait for the 1st step to complete before doing the next steps. Is there an Elasticsearch endpoint I can poll to find out when the clone is complete?


Solution

  • Tldr;

    If I recall correctly, there is no specific endpoint for monitoring the clone API. But you can use the cat recovery api

    Demo

    POST old/_clone/new
    
    # This call is to be made until it returns nothing
    GET _cat/recovery/new?active_only=true&format=json
    
    DELETE old