diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/TransportCreateSnapshotAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/TransportCreateSnapshotAction.java index b4320f5b4f7..abd50f0785a 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/TransportCreateSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/TransportCreateSnapshotAction.java @@ -73,24 +73,14 @@ public class TransportCreateSnapshotAction extends TransportMasterNodeAction listener) { - final String snapshotName = indexNameExpressionResolver.resolveDateMathExpression(request.snapshot()); - SnapshotsService.SnapshotRequest snapshotRequest = - new SnapshotsService.SnapshotRequest(request.repository(), snapshotName, "create_snapshot [" + snapshotName + "]") - .indices(request.indices()) - .indicesOptions(request.indicesOptions()) - .partial(request.partial()) - .settings(request.settings()) - .includeGlobalState(request.includeGlobalState()) - .masterNodeTimeout(request.masterNodeTimeout()); - snapshotsService.createSnapshot(snapshotRequest, new SnapshotsService.CreateSnapshotListener() { + snapshotsService.createSnapshot(request, new SnapshotsService.CreateSnapshotListener() { @Override - public void onResponse() { + public void onResponse(Snapshot snapshotCreated) { if (request.waitForCompletion()) { snapshotsService.addListener(new SnapshotsService.SnapshotCompletionListener() { @Override public void onSnapshotCompletion(Snapshot snapshot, SnapshotInfo snapshotInfo) { - if (snapshot.getRepository().equals(request.repository()) && - snapshot.getSnapshotId().getName().equals(snapshotName)) { + if (snapshotCreated.equals(snapshot)) { listener.onResponse(new CreateSnapshotResponse(snapshotInfo)); snapshotsService.removeListener(this); } @@ -98,8 +88,7 @@ public class TransportCreateSnapshotAction extends TransportMasterNodeAction * A typical snapshot creating process looks like this: *