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.

Previous post Reflections in java
Next post Why ES 6.x doesn’t allow multiple types?