use of org.elasticsearch.action.admin.indices.create.CreatePartitionsRequest in project crate by crate.
the class ShardingUpsertExecutor method createPartitions.
private CompletableFuture<AcknowledgedResponse> createPartitions(Map<String, List<ShardedRequests.ItemAndRoutingAndSourceInfo<ShardUpsertRequest.Item>>> itemsByMissingIndex) {
FutureActionListener<AcknowledgedResponse, AcknowledgedResponse> listener = FutureActionListener.newInstance();
createPartitionsAction.execute(new CreatePartitionsRequest(itemsByMissingIndex.keySet(), jobId), listener);
return listener;
}
use of org.elasticsearch.action.admin.indices.create.CreatePartitionsRequest in project crate by crate.
the class InsertFromValues method createIndices.
private static CompletableFuture<AcknowledgedResponse> createIndices(TransportCreatePartitionsAction createPartitionsAction, Set<String> indices, ClusterService clusterService, UUID jobId) {
Metadata metadata = clusterService.state().getMetadata();
List<String> indicesToCreate = new ArrayList<>();
for (var index : indices) {
if (IndexParts.isPartitioned(index) && metadata.hasIndex(index) == false) {
indicesToCreate.add(index);
}
}
if (indicesToCreate.isEmpty()) {
return CompletableFuture.completedFuture(new AcknowledgedResponse(true));
}
FutureActionListener<AcknowledgedResponse, AcknowledgedResponse> listener = new FutureActionListener<>(r -> r);
createPartitionsAction.execute(new CreatePartitionsRequest(indicesToCreate, jobId), listener);
return listener;
}
Aggregations