Clone Snapshot APIedit
The Clone Snapshot API clones part or all of a snapshot into a new snapshot.
Requestedit
A CloneSnapshotRequest
:
CloneSnapshotRequest request = new CloneSnapshotRequest(repositoryName, sourceSnapshotName, targetSnapshotName, indices);
Indices to Cloneedit
Use indices
to specify a list of indices from the source snapshot to include
in the snapshot clone:
Index Settings and Optionsedit
You can also customize index settings and options when cloning a snapshot:
Further Argumentsedit
You can also provide the following optional arguments:
Synchronous Executionedit
AcknowledgedResponse response = client.snapshot().clone(request, RequestOptions.DEFAULT);
Asynchronous Executionedit
The asynchronous execution of a clone snapshot request requires both the
CloneSnapshotRequest
instance and an ActionListener
instance to be
passed to the asynchronous method:
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.
A typical listener for AcknowledgedResponse
looks like:
Responseedit
AcknowledgedResponse
indicates whether the request was received: