use of org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest in project crate by crate.
the class SnapshotRestoreAnalyzerTest method testCreateSnapshotAll.
@Test
public void testCreateSnapshotAll() throws Exception {
CreateSnapshotRequest request = analyze(e, "CREATE SNAPSHOT my_repo.my_snapshot ALL WITH (wait_for_completion=true)");
assertThat(request.indices(), arrayContainingInAnyOrder(AnalyzedCreateSnapshot.ALL_INDICES.toArray()));
assertThat(request.repository(), is("my_repo"));
assertThat(request.snapshot(), is("my_snapshot"));
assertThat(request.settings().getAsStructuredMap(), hasEntry("wait_for_completion", "true"));
}
use of org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest in project elasticsearch by elastic.
the class RestCreateSnapshotAction method prepareRequest.
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
CreateSnapshotRequest createSnapshotRequest = createSnapshotRequest(request.param("repository"), request.param("snapshot"));
request.applyContentParser(p -> createSnapshotRequest.source(p.mapOrdered()));
createSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", createSnapshotRequest.masterNodeTimeout()));
createSnapshotRequest.waitForCompletion(request.paramAsBoolean("wait_for_completion", false));
return channel -> client.admin().cluster().createSnapshot(createSnapshotRequest, new RestToXContentListener<>(channel));
}
use of org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest in project crate by crate.
the class SnapshotRestoreAnalyzerTest method testCreateSnapshotUnknownTableIgnore.
@Test
public void testCreateSnapshotUnknownTableIgnore() throws Exception {
CreateSnapshotRequest request = analyze(e, "CREATE SNAPSHOT my_repo.my_snapshot TABLE users, t2 WITH (ignore_unavailable=true)");
assertThat(request.indices(), arrayContaining("users"));
assertThat(request.indicesOptions().ignoreUnavailable(), is(true));
}
use of org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest in project crate by crate.
the class SnapshotRestoreAnalyzerTest method testCreateSnapshotListTablesTwice.
@Test
public void testCreateSnapshotListTablesTwice() throws Exception {
CreateSnapshotRequest request = analyze(e, "CREATE SNAPSHOT my_repo.my_snapshot TABLE users, locations, users");
assertThat(request.indices(), arrayContainingInAnyOrder("users", "locations"));
}
use of org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest in project crate by crate.
the class SnapshotRestoreAnalyzerTest method testCreateSnapshotListPartitionsAndPartitionedTable.
@Test
public void testCreateSnapshotListPartitionsAndPartitionedTable() throws Exception {
CreateSnapshotRequest request = analyze(e, "CREATE SNAPSHOT my_repo.my_snapshot TABLE parted, parted PARTITION (date=1395961200000)");
assertThat(request.indices(), arrayContainingInAnyOrder(".partitioned.parted.04732cpp6ks3ed1o60o30c1g", ".partitioned.parted.0400", ".partitioned.parted.04732cpp6ksjcc9i60o30c1g"));
assertThat(request.includeGlobalState(), is(false));
assertThat(request.templates(), arrayContainingInAnyOrder(".partitioned.parted."));
}
Aggregations