To re-index an index using java, build a re-index request using ReindexRequestBuilder API like:

ReindexRequestBuilder reindexRequest = 
new ReindexRequestBuilder(client,ReindexAction.INSTANCE)

After creating a request execute the request:


To validate whether the request is executed or not add a validation check:

if(copy.execute().isDone()) {
System.out.println("Request is executed");

Bingo! Your index is re-indexed.

Leave a Reply

Your email address will not be published. Required fields are marked *