Migration Upgrade

edit

Index Upgrade Request

edit

An IndexUpgradeRequest requires an index argument. Only one index at the time should be upgraded:

IndexUpgradeRequest request = new IndexUpgradeRequest("test"); 

Create a new request instance

Execution

edit
BulkByScrollResponse response = client.migration().upgrade(request, RequestOptions.DEFAULT);

Response

edit

The returned BulkByScrollResponse contains information about the executed operation

Asynchronous Execution

edit

The asynchronous execution of an upgrade request requires both the IndexUpgradeRequest instance and an ActionListener instance to be passed to the asynchronous method:

ActionListener<BulkByScrollResponse> listener = new ActionListener<BulkByScrollResponse>() {
    @Override
    public void onResponse(BulkByScrollResponse bulkResponse) {
        
    }

    @Override
    public void onFailure(Exception e) {
        
    }
};

Called when the execution is successfully completed. The response is provided as an argument and contains a list of individual results for each operation that was executed. Note that one or more operations might have failed while the others have been successfully executed.

Called when the whole IndexUpgradeRequest fails. In this case the raised exception is provided as an argument and no operation has been executed.

client.migration().upgradeAsync(new IndexUpgradeRequest("test"), RequestOptions.DEFAULT, listener); 

The IndexUpgradeRequest to execute and the ActionListener to use when the execution completes

The asynchronous method does not block and returns immediately. Once it is completed the ActionListener is called back using the onResponse method if the execution successfully completed or using the onFailure method if it failed.