diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml
index f7c5d5defb7..c065ca576ea 100644
--- a/buildSrc/src/main/resources/checkstyle_suppressions.xml
+++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml
@@ -17,23 +17,15 @@
-
+
+
+
-
-
-
-
-
-
-
-
-
-
diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/AbstractBenchmark.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/AbstractBenchmark.java
index f4d3f34ba29..de9d075cb9a 100644
--- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/AbstractBenchmark.java
+++ b/client/benchmark/src/main/java/org/opensearch/client/benchmark/AbstractBenchmark.java
@@ -77,8 +77,7 @@ public abstract class AbstractBenchmark {
@SuppressForbidden(reason = "system out is ok for a command line tool")
private void runBulkIndexBenchmark(String[] args) throws Exception {
if (args.length != 7) {
- System.err.println(
- "usage: 'bulk' benchmarkTargetHostIp indexFilePath indexName typeName numberOfDocuments bulkSize");
+ System.err.println("usage: 'bulk' benchmarkTargetHostIp indexFilePath indexName typeName numberOfDocuments bulkSize");
System.exit(1);
}
String benchmarkTargetHost = args[1];
@@ -95,9 +94,11 @@ public abstract class AbstractBenchmark {
T client = client(benchmarkTargetHost);
- BenchmarkRunner benchmark = new BenchmarkRunner(warmupIterations, iterations,
- new BulkBenchmarkTask(
- bulkRequestExecutor(client, indexName, typeName), indexFilePath, warmupIterations, iterations, bulkSize));
+ BenchmarkRunner benchmark = new BenchmarkRunner(
+ warmupIterations,
+ iterations,
+ new BulkBenchmarkTask(bulkRequestExecutor(client, indexName, typeName), indexFilePath, warmupIterations, iterations, bulkSize)
+ );
try {
runTrials(() -> {
@@ -113,8 +114,7 @@ public abstract class AbstractBenchmark {
@SuppressForbidden(reason = "system out is ok for a command line tool")
private void runSearchBenchmark(String[] args) throws Exception {
if (args.length != 5) {
- System.err.println(
- "usage: 'search' benchmarkTargetHostIp indexName searchRequestBody throughputRates");
+ System.err.println("usage: 'search' benchmarkTargetHostIp indexName searchRequestBody throughputRates");
System.exit(1);
}
String benchmarkTargetHost = args[1];
@@ -127,12 +127,19 @@ public abstract class AbstractBenchmark {
try {
runTrials(() -> {
for (int throughput : throughputRates) {
- //GC between trials to reduce the likelihood of a GC occurring in the middle of a trial.
+ // GC between trials to reduce the likelihood of a GC occurring in the middle of a trial.
runGc();
- BenchmarkRunner benchmark = new BenchmarkRunner(SEARCH_BENCHMARK_ITERATIONS, SEARCH_BENCHMARK_ITERATIONS,
+ BenchmarkRunner benchmark = new BenchmarkRunner(
+ SEARCH_BENCHMARK_ITERATIONS,
+ SEARCH_BENCHMARK_ITERATIONS,
new SearchBenchmarkTask(
- searchRequestExecutor(client, indexName), searchBody, SEARCH_BENCHMARK_ITERATIONS,
- SEARCH_BENCHMARK_ITERATIONS, throughput));
+ searchRequestExecutor(client, indexName),
+ searchBody,
+ SEARCH_BENCHMARK_ITERATIONS,
+ SEARCH_BENCHMARK_ITERATIONS,
+ throughput
+ )
+ );
System.out.printf("Target throughput = %d ops / s%n", throughput);
benchmark.run();
}
diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkRunner.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkRunner.java
index 9fb9e569402..4beb82b939b 100644
--- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkRunner.java
+++ b/client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkRunner.java
@@ -55,8 +55,12 @@ public final class BenchmarkRunner {
@SuppressForbidden(reason = "system out is ok for a command line tool")
public void run() {
SampleRecorder recorder = new SampleRecorder(iterations);
- System.out.printf("Running %s with %d warmup iterations and %d iterations.%n",
- task.getClass().getSimpleName(), warmupIterations, iterations);
+ System.out.printf(
+ "Running %s with %d warmup iterations and %d iterations.%n",
+ task.getClass().getSimpleName(),
+ warmupIterations,
+ iterations
+ );
try {
task.setUp(recorder);
@@ -78,14 +82,26 @@ public final class BenchmarkRunner {
for (Metrics metrics : summaryMetrics) {
String throughput = String.format(Locale.ROOT, "Throughput [ops/s]: %f", metrics.throughput);
- String serviceTimes = String.format(Locale.ROOT,
+ String serviceTimes = String.format(
+ Locale.ROOT,
"Service time [ms]: p50 = %f, p90 = %f, p95 = %f, p99 = %f, p99.9 = %f, p99.99 = %f",
- metrics.serviceTimeP50, metrics.serviceTimeP90, metrics.serviceTimeP95,
- metrics.serviceTimeP99, metrics.serviceTimeP999, metrics.serviceTimeP9999);
- String latencies = String.format(Locale.ROOT,
+ metrics.serviceTimeP50,
+ metrics.serviceTimeP90,
+ metrics.serviceTimeP95,
+ metrics.serviceTimeP99,
+ metrics.serviceTimeP999,
+ metrics.serviceTimeP9999
+ );
+ String latencies = String.format(
+ Locale.ROOT,
"Latency [ms]: p50 = %f, p90 = %f, p95 = %f, p99 = %f, p99.9 = %f, p99.99 = %f",
- metrics.latencyP50, metrics.latencyP90, metrics.latencyP95,
- metrics.latencyP99, metrics.latencyP999, metrics.latencyP9999);
+ metrics.latencyP50,
+ metrics.latencyP90,
+ metrics.latencyP95,
+ metrics.latencyP99,
+ metrics.latencyP999,
+ metrics.latencyP9999
+ );
int lineLength = Math.max(serviceTimes.length(), latencies.length());
diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/Metrics.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/Metrics.java
index 31c3e298abe..93bf01d1264 100644
--- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/Metrics.java
+++ b/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/Metrics.java
@@ -49,10 +49,24 @@ public final class Metrics {
public final double latencyP999;
public final double latencyP9999;
- public Metrics(String operation, long successCount, long errorCount, double throughput,
- double serviceTimeP50, double serviceTimeP90, double serviceTimeP95, double serviceTimeP99,
- double serviceTimeP999, double serviceTimeP9999, double latencyP50, double latencyP90,
- double latencyP95, double latencyP99, double latencyP999, double latencyP9999) {
+ public Metrics(
+ String operation,
+ long successCount,
+ long errorCount,
+ double throughput,
+ double serviceTimeP50,
+ double serviceTimeP90,
+ double serviceTimeP95,
+ double serviceTimeP99,
+ double serviceTimeP999,
+ double serviceTimeP9999,
+ double latencyP50,
+ double latencyP90,
+ double latencyP95,
+ double latencyP99,
+ double latencyP999,
+ double latencyP9999
+ ) {
this.operation = operation;
this.successCount = successCount;
this.errorCount = errorCount;
diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/MetricsCalculator.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/MetricsCalculator.java
index 80cd62298bb..b64ea8143d7 100644
--- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/MetricsCalculator.java
+++ b/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/MetricsCalculator.java
@@ -75,24 +75,28 @@ public final class MetricsCalculator {
it++;
}
- metrics.add(new Metrics(operationAndMetrics.getKey(),
- samples.stream().filter((r) -> r.isSuccess()).count(),
- samples.stream().filter((r) -> !r.isSuccess()).count(),
- // throughput calculation is based on the total (Wall clock) time it took to generate all samples
- calculateThroughput(samples.size(), latestEnd - firstStart),
- // convert ns -> ms without losing precision
- StatUtils.percentile(serviceTimes, 50.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
- StatUtils.percentile(serviceTimes, 90.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
- StatUtils.percentile(serviceTimes, 95.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
- StatUtils.percentile(serviceTimes, 99.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
- StatUtils.percentile(serviceTimes, 99.9d) / TimeUnit.MILLISECONDS.toNanos(1L),
- StatUtils.percentile(serviceTimes, 99.99d) / TimeUnit.MILLISECONDS.toNanos(1L),
- StatUtils.percentile(latencies, 50.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
- StatUtils.percentile(latencies, 90.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
- StatUtils.percentile(latencies, 95.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
- StatUtils.percentile(latencies, 99.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
- StatUtils.percentile(latencies, 99.9d) / TimeUnit.MILLISECONDS.toNanos(1L),
- StatUtils.percentile(latencies, 99.99d) / TimeUnit.MILLISECONDS.toNanos(1L)));
+ metrics.add(
+ new Metrics(
+ operationAndMetrics.getKey(),
+ samples.stream().filter((r) -> r.isSuccess()).count(),
+ samples.stream().filter((r) -> !r.isSuccess()).count(),
+ // throughput calculation is based on the total (Wall clock) time it took to generate all samples
+ calculateThroughput(samples.size(), latestEnd - firstStart),
+ // convert ns -> ms without losing precision
+ StatUtils.percentile(serviceTimes, 50.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
+ StatUtils.percentile(serviceTimes, 90.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
+ StatUtils.percentile(serviceTimes, 95.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
+ StatUtils.percentile(serviceTimes, 99.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
+ StatUtils.percentile(serviceTimes, 99.9d) / TimeUnit.MILLISECONDS.toNanos(1L),
+ StatUtils.percentile(serviceTimes, 99.99d) / TimeUnit.MILLISECONDS.toNanos(1L),
+ StatUtils.percentile(latencies, 50.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
+ StatUtils.percentile(latencies, 90.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
+ StatUtils.percentile(latencies, 95.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
+ StatUtils.percentile(latencies, 99.0d) / TimeUnit.MILLISECONDS.toNanos(1L),
+ StatUtils.percentile(latencies, 99.9d) / TimeUnit.MILLISECONDS.toNanos(1L),
+ StatUtils.percentile(latencies, 99.99d) / TimeUnit.MILLISECONDS.toNanos(1L)
+ )
+ );
}
return metrics;
}
diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/bulk/BulkBenchmarkTask.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/bulk/BulkBenchmarkTask.java
index 56b59c6f6e8..459cba1ce5f 100644
--- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/bulk/BulkBenchmarkTask.java
+++ b/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/bulk/BulkBenchmarkTask.java
@@ -62,8 +62,13 @@ public class BulkBenchmarkTask implements BenchmarkTask {
private LoadGenerator generator;
private ExecutorService executorService;
- public BulkBenchmarkTask(BulkRequestExecutor requestExecutor, String indexFilePath, int warmupIterations, int measurementIterations,
- int bulkSize) {
+ public BulkBenchmarkTask(
+ BulkRequestExecutor requestExecutor,
+ String indexFilePath,
+ int warmupIterations,
+ int measurementIterations,
+ int bulkSize
+ ) {
this.requestExecutor = requestExecutor;
this.indexFilePath = indexFilePath;
this.warmupIterations = warmupIterations;
@@ -86,11 +91,11 @@ public class BulkBenchmarkTask implements BenchmarkTask {
@Override
@SuppressForbidden(reason = "system out is ok for a command line tool")
- public void run() throws Exception {
+ public void run() throws Exception {
generator.execute();
// when the generator is done, there are no more data -> shutdown client
executorService.shutdown();
- //We need to wait until the queue is drained
+ // We need to wait until the queue is drained
final boolean finishedNormally = executorService.awaitTermination(20, TimeUnit.MINUTES);
if (finishedNormally == false) {
System.err.println("Background tasks are still running after timeout on enclosing pool. Forcing pool shutdown.");
@@ -100,7 +105,7 @@ public class BulkBenchmarkTask implements BenchmarkTask {
@Override
public void tearDown() {
- //no op
+ // no op
}
private static final class LoadGenerator {
@@ -146,7 +151,6 @@ public class BulkBenchmarkTask implements BenchmarkTask {
}
}
-
private static final class BulkIndexer implements Runnable {
private static final Logger logger = LogManager.getLogger(BulkIndexer.class);
@@ -156,8 +160,13 @@ public class BulkBenchmarkTask implements BenchmarkTask {
private final BulkRequestExecutor bulkRequestExecutor;
private final SampleRecorder sampleRecorder;
- BulkIndexer(BlockingQueue> bulkData, int warmupIterations, int measurementIterations,
- SampleRecorder sampleRecorder, BulkRequestExecutor bulkRequestExecutor) {
+ BulkIndexer(
+ BlockingQueue> bulkData,
+ int warmupIterations,
+ int measurementIterations,
+ SampleRecorder sampleRecorder,
+ BulkRequestExecutor bulkRequestExecutor
+ ) {
this.bulkData = bulkData;
this.warmupIterations = warmupIterations;
this.measurementIterations = measurementIterations;
@@ -176,7 +185,7 @@ public class BulkBenchmarkTask implements BenchmarkTask {
Thread.currentThread().interrupt();
return;
}
- //measure only service time, latency is not that interesting for a throughput benchmark
+ // measure only service time, latency is not that interesting for a throughput benchmark
long start = System.nanoTime();
try {
success = bulkRequestExecutor.bulkIndex(currentBulk);
diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/search/SearchBenchmarkTask.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/search/SearchBenchmarkTask.java
index 4a373149873..3b232cb3bdb 100644
--- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/search/SearchBenchmarkTask.java
+++ b/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/search/SearchBenchmarkTask.java
@@ -46,8 +46,13 @@ public class SearchBenchmarkTask implements BenchmarkTask {
private SampleRecorder sampleRecorder;
- public SearchBenchmarkTask(SearchRequestExecutor searchRequestExecutor, String body, int warmupIterations,
- int measurementIterations, int targetThroughput) {
+ public SearchBenchmarkTask(
+ SearchRequestExecutor searchRequestExecutor,
+ String body,
+ int warmupIterations,
+ int measurementIterations,
+ int targetThroughput
+ ) {
this.searchRequestExecutor = searchRequestExecutor;
this.searchRequestBody = body;
this.warmupIterations = warmupIterations;
diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/rest/RestClientBenchmark.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/rest/RestClientBenchmark.java
index 8d44142b0ce..073fd5eab5c 100644
--- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/rest/RestClientBenchmark.java
+++ b/client/benchmark/src/main/java/org/opensearch/client/benchmark/rest/RestClientBenchmark.java
@@ -56,10 +56,10 @@ public final class RestClientBenchmark extends AbstractBenchmark {
@Override
protected RestClient client(String benchmarkTargetHost) {
- return RestClient
- .builder(new HttpHost(benchmarkTargetHost, 9200))
- .setHttpClientConfigCallback(b -> b.setDefaultHeaders(
- Collections.singleton(new BasicHeader(HttpHeaders.ACCEPT_ENCODING, "gzip"))))
+ return RestClient.builder(new HttpHost(benchmarkTargetHost, 9200))
+ .setHttpClientConfigCallback(
+ b -> b.setDefaultHeaders(Collections.singleton(new BasicHeader(HttpHeaders.ACCEPT_ENCODING, "gzip")))
+ )
.setRequestConfigCallback(b -> b.setContentCompressionEnabled(true))
.build();
}
diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/NoopPlugin.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/NoopPlugin.java
index 250825379c5..e9d0fff2a9d 100644
--- a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/NoopPlugin.java
+++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/NoopPlugin.java
@@ -64,11 +64,15 @@ public class NoopPlugin extends Plugin implements ActionPlugin {
}
@Override
- public List getRestHandlers(Settings settings, RestController restController, ClusterSettings clusterSettings,
- IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter, IndexNameExpressionResolver indexNameExpressionResolver,
- Supplier nodesInCluster) {
- return Arrays.asList(
- new RestNoopBulkAction(),
- new RestNoopSearchAction());
+ public List getRestHandlers(
+ Settings settings,
+ RestController restController,
+ ClusterSettings clusterSettings,
+ IndexScopedSettings indexScopedSettings,
+ SettingsFilter settingsFilter,
+ IndexNameExpressionResolver indexNameExpressionResolver,
+ Supplier nodesInCluster
+ ) {
+ return Arrays.asList(new RestNoopBulkAction(), new RestNoopSearchAction());
}
}
diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/RestNoopBulkAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/RestNoopBulkAction.java
index 81eb77bfd44..8f42744aeb5 100644
--- a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/RestNoopBulkAction.java
+++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/RestNoopBulkAction.java
@@ -62,13 +62,16 @@ public class RestNoopBulkAction extends BaseRestHandler {
@Override
public List routes() {
- return unmodifiableList(asList(
- new Route(POST, "/_noop_bulk"),
- new Route(PUT, "/_noop_bulk"),
- new Route(POST, "/{index}/_noop_bulk"),
- new Route(PUT, "/{index}/_noop_bulk"),
- new Route(POST, "/{index}/{type}/_noop_bulk"),
- new Route(PUT, "/{index}/{type}/_noop_bulk")));
+ return unmodifiableList(
+ asList(
+ new Route(POST, "/_noop_bulk"),
+ new Route(PUT, "/_noop_bulk"),
+ new Route(POST, "/{index}/_noop_bulk"),
+ new Route(PUT, "/{index}/_noop_bulk"),
+ new Route(POST, "/{index}/{type}/_noop_bulk"),
+ new Route(PUT, "/{index}/{type}/_noop_bulk")
+ )
+ );
}
@Override
@@ -91,8 +94,17 @@ public class RestNoopBulkAction extends BaseRestHandler {
}
bulkRequest.timeout(request.paramAsTime("timeout", BulkShardRequest.DEFAULT_TIMEOUT));
bulkRequest.setRefreshPolicy(request.param("refresh"));
- bulkRequest.add(request.requiredContent(), defaultIndex, defaultType, defaultRouting,
- null, defaultPipeline, defaultRequireAlias, true, request.getXContentType());
+ bulkRequest.add(
+ request.requiredContent(),
+ defaultIndex,
+ defaultType,
+ defaultRouting,
+ null,
+ defaultPipeline,
+ defaultRequireAlias,
+ true,
+ request.getXContentType()
+ );
// short circuit the call to the transport layer
return channel -> {
@@ -102,12 +114,14 @@ public class RestNoopBulkAction extends BaseRestHandler {
}
private static class BulkRestBuilderListener extends RestBuilderListener {
- private final BulkItemResponse ITEM_RESPONSE = new BulkItemResponse(1, DocWriteRequest.OpType.UPDATE,
- new UpdateResponse(new ShardId("mock", "", 1), "mock_type", "1", 0L, 1L, 1L, DocWriteResponse.Result.CREATED));
+ private final BulkItemResponse ITEM_RESPONSE = new BulkItemResponse(
+ 1,
+ DocWriteRequest.OpType.UPDATE,
+ new UpdateResponse(new ShardId("mock", "", 1), "mock_type", "1", 0L, 1L, 1L, DocWriteResponse.Result.CREATED)
+ );
private final RestRequest request;
-
BulkRestBuilderListener(RestChannel channel, RestRequest request) {
super(channel);
this.request = request;
diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/TransportNoopBulkAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/TransportNoopBulkAction.java
index 3b3743a2281..53fa96b592e 100644
--- a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/TransportNoopBulkAction.java
+++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/TransportNoopBulkAction.java
@@ -46,8 +46,11 @@ import org.opensearch.tasks.Task;
import org.opensearch.transport.TransportService;
public class TransportNoopBulkAction extends HandledTransportAction {
- private static final BulkItemResponse ITEM_RESPONSE = new BulkItemResponse(1, DocWriteRequest.OpType.UPDATE,
- new UpdateResponse(new ShardId("mock", "", 1), "mock_type", "1", 0L, 1L, 1L, DocWriteResponse.Result.CREATED));
+ private static final BulkItemResponse ITEM_RESPONSE = new BulkItemResponse(
+ 1,
+ DocWriteRequest.OpType.UPDATE,
+ new UpdateResponse(new ShardId("mock", "", 1), "mock_type", "1", 0L, 1L, 1L, DocWriteResponse.Result.CREATED)
+ );
@Inject
public TransportNoopBulkAction(TransportService transportService, ActionFilters actionFilters) {
diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/RestNoopSearchAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/RestNoopSearchAction.java
index 12ad7f3f254..3f7be044653 100644
--- a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/RestNoopSearchAction.java
+++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/RestNoopSearchAction.java
@@ -48,13 +48,16 @@ public class RestNoopSearchAction extends BaseRestHandler {
@Override
public List routes() {
- return unmodifiableList(asList(
- new Route(GET, "/_noop_search"),
- new Route(POST, "/_noop_search"),
- new Route(GET, "/{index}/_noop_search"),
- new Route(POST, "/{index}/_noop_search"),
- new Route(GET, "/{index}/{type}/_noop_search"),
- new Route(POST, "/{index}/{type}/_noop_search")));
+ return unmodifiableList(
+ asList(
+ new Route(GET, "/_noop_search"),
+ new Route(POST, "/_noop_search"),
+ new Route(GET, "/{index}/_noop_search"),
+ new Route(POST, "/{index}/_noop_search"),
+ new Route(GET, "/{index}/{type}/_noop_search"),
+ new Route(POST, "/{index}/{type}/_noop_search")
+ )
+ );
}
@Override
diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/TransportNoopSearchAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/TransportNoopSearchAction.java
index 557aaa4d5e2..77668a030ee 100644
--- a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/TransportNoopSearchAction.java
+++ b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/TransportNoopSearchAction.java
@@ -59,12 +59,25 @@ public class TransportNoopSearchAction extends HandledTransportAction listener) {
- listener.onResponse(new SearchResponse(new InternalSearchResponse(
- new SearchHits(
- new SearchHit[0], new TotalHits(0L, TotalHits.Relation.EQUAL_TO), 0.0f),
- InternalAggregations.EMPTY,
- new Suggest(Collections.emptyList()),
- new SearchProfileShardResults(Collections.emptyMap()), false, false, 1),
- "", 1, 1, 0, 0, ShardSearchFailure.EMPTY_ARRAY, SearchResponse.Clusters.EMPTY));
+ listener.onResponse(
+ new SearchResponse(
+ new InternalSearchResponse(
+ new SearchHits(new SearchHit[0], new TotalHits(0L, TotalHits.Relation.EQUAL_TO), 0.0f),
+ InternalAggregations.EMPTY,
+ new Suggest(Collections.emptyList()),
+ new SearchProfileShardResults(Collections.emptyMap()),
+ false,
+ false,
+ 1
+ ),
+ "",
+ 1,
+ 1,
+ 0,
+ 0,
+ ShardSearchFailure.EMPTY_ARRAY,
+ SearchResponse.Clusters.EMPTY
+ )
+ );
}
}
diff --git a/client/rest-high-level/src/main/java/org/opensearch/client/ClusterClient.java b/client/rest-high-level/src/main/java/org/opensearch/client/ClusterClient.java
index 6c79e0145da..10cfec94978 100644
--- a/client/rest-high-level/src/main/java/org/opensearch/client/ClusterClient.java
+++ b/client/rest-high-level/src/main/java/org/opensearch/client/ClusterClient.java
@@ -73,9 +73,14 @@ public final class ClusterClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public ClusterUpdateSettingsResponse putSettings(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest, RequestOptions options)
- throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(clusterUpdateSettingsRequest, ClusterRequestConverters::clusterPutSettings,
- options, ClusterUpdateSettingsResponse::fromXContent, emptySet());
+ throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ clusterUpdateSettingsRequest,
+ ClusterRequestConverters::clusterPutSettings,
+ options,
+ ClusterUpdateSettingsResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -86,11 +91,19 @@ public final class ClusterClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable putSettingsAsync(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(clusterUpdateSettingsRequest,
- ClusterRequestConverters::clusterPutSettings,
- options, ClusterUpdateSettingsResponse::fromXContent, listener, emptySet());
+ public Cancellable putSettingsAsync(
+ ClusterUpdateSettingsRequest clusterUpdateSettingsRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ clusterUpdateSettingsRequest,
+ ClusterRequestConverters::clusterPutSettings,
+ options,
+ ClusterUpdateSettingsResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -103,8 +116,13 @@ public final class ClusterClient {
*/
public ClusterGetSettingsResponse getSettings(ClusterGetSettingsRequest clusterGetSettingsRequest, RequestOptions options)
throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(clusterGetSettingsRequest, ClusterRequestConverters::clusterGetSettings,
- options, ClusterGetSettingsResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ clusterGetSettingsRequest,
+ ClusterRequestConverters::clusterGetSettings,
+ options,
+ ClusterGetSettingsResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -115,11 +133,19 @@ public final class ClusterClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable getSettingsAsync(ClusterGetSettingsRequest clusterGetSettingsRequest, RequestOptions options,
- ActionListener listener) {
+ public Cancellable getSettingsAsync(
+ ClusterGetSettingsRequest clusterGetSettingsRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
return restHighLevelClient.performRequestAsyncAndParseEntity(
- clusterGetSettingsRequest, ClusterRequestConverters::clusterGetSettings,
- options, ClusterGetSettingsResponse::fromXContent, listener, emptySet());
+ clusterGetSettingsRequest,
+ ClusterRequestConverters::clusterGetSettings,
+ options,
+ ClusterGetSettingsResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -133,8 +159,13 @@ public final class ClusterClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public ClusterHealthResponse health(ClusterHealthRequest healthRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(healthRequest, ClusterRequestConverters::clusterHealth, options,
- ClusterHealthResponse::fromXContent, singleton(RestStatus.REQUEST_TIMEOUT.getStatus()));
+ return restHighLevelClient.performRequestAndParseEntity(
+ healthRequest,
+ ClusterRequestConverters::clusterHealth,
+ options,
+ ClusterHealthResponse::fromXContent,
+ singleton(RestStatus.REQUEST_TIMEOUT.getStatus())
+ );
}
/**
@@ -146,10 +177,19 @@ public final class ClusterClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable healthAsync(ClusterHealthRequest healthRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(healthRequest, ClusterRequestConverters::clusterHealth, options,
- ClusterHealthResponse::fromXContent, listener, singleton(RestStatus.REQUEST_TIMEOUT.getStatus()));
+ public Cancellable healthAsync(
+ ClusterHealthRequest healthRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ healthRequest,
+ ClusterRequestConverters::clusterHealth,
+ options,
+ ClusterHealthResponse::fromXContent,
+ listener,
+ singleton(RestStatus.REQUEST_TIMEOUT.getStatus())
+ );
}
/**
@@ -161,8 +201,13 @@ public final class ClusterClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public RemoteInfoResponse remoteInfo(RemoteInfoRequest request, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request, ClusterRequestConverters::remoteInfo, options,
- RemoteInfoResponse::fromXContent, singleton(RestStatus.REQUEST_TIMEOUT.getStatus()));
+ return restHighLevelClient.performRequestAndParseEntity(
+ request,
+ ClusterRequestConverters::remoteInfo,
+ options,
+ RemoteInfoResponse::fromXContent,
+ singleton(RestStatus.REQUEST_TIMEOUT.getStatus())
+ );
}
/**
@@ -173,10 +218,15 @@ public final class ClusterClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable remoteInfoAsync(RemoteInfoRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request, ClusterRequestConverters::remoteInfo, options,
- RemoteInfoResponse::fromXContent, listener, singleton(RestStatus.REQUEST_TIMEOUT.getStatus()));
+ public Cancellable remoteInfoAsync(RemoteInfoRequest request, RequestOptions options, ActionListener listener) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ request,
+ ClusterRequestConverters::remoteInfo,
+ options,
+ RemoteInfoResponse::fromXContent,
+ listener,
+ singleton(RestStatus.REQUEST_TIMEOUT.getStatus())
+ );
}
/**
@@ -187,8 +237,13 @@ public final class ClusterClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public AcknowledgedResponse deleteComponentTemplate(DeleteComponentTemplateRequest req, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(req, ClusterRequestConverters::deleteComponentTemplate,
- options, AcknowledgedResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ req,
+ ClusterRequestConverters::deleteComponentTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -199,10 +254,19 @@ public final class ClusterClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable deleteComponentTemplateAsync(DeleteComponentTemplateRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request, ClusterRequestConverters::deleteComponentTemplate,
- options, AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable deleteComponentTemplateAsync(
+ DeleteComponentTemplateRequest request,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ request,
+ ClusterRequestConverters::deleteComponentTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -213,10 +277,15 @@ public final class ClusterClient {
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public AcknowledgedResponse putComponentTemplate(PutComponentTemplateRequest putComponentTemplateRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(putComponentTemplateRequest, ClusterRequestConverters::putComponentTemplate,
- options, AcknowledgedResponse::fromXContent, emptySet());
+ public AcknowledgedResponse putComponentTemplate(PutComponentTemplateRequest putComponentTemplateRequest, RequestOptions options)
+ throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ putComponentTemplateRequest,
+ ClusterRequestConverters::putComponentTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -227,10 +296,19 @@ public final class ClusterClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable putComponentTemplateAsync(PutComponentTemplateRequest putComponentTemplateRequest,
- RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(putComponentTemplateRequest,
- ClusterRequestConverters::putComponentTemplate, options, AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable putComponentTemplateAsync(
+ PutComponentTemplateRequest putComponentTemplateRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ putComponentTemplateRequest,
+ ClusterRequestConverters::putComponentTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -240,10 +318,17 @@ public final class ClusterClient {
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public GetComponentTemplatesResponse getComponentTemplate(GetComponentTemplatesRequest getComponentTemplatesRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getComponentTemplatesRequest,
- ClusterRequestConverters::getComponentTemplates, options, GetComponentTemplatesResponse::fromXContent, emptySet());
+ public GetComponentTemplatesResponse getComponentTemplate(
+ GetComponentTemplatesRequest getComponentTemplatesRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ getComponentTemplatesRequest,
+ ClusterRequestConverters::getComponentTemplates,
+ options,
+ GetComponentTemplatesResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -253,10 +338,19 @@ public final class ClusterClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable getComponentTemplateAsync(GetComponentTemplatesRequest getComponentTemplatesRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(getComponentTemplatesRequest,
- ClusterRequestConverters::getComponentTemplates, options, GetComponentTemplatesResponse::fromXContent, listener, emptySet());
+ public Cancellable getComponentTemplateAsync(
+ GetComponentTemplatesRequest getComponentTemplatesRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ getComponentTemplatesRequest,
+ ClusterRequestConverters::getComponentTemplates,
+ options,
+ GetComponentTemplatesResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -267,10 +361,15 @@ public final class ClusterClient {
* @return true if any index templates in the request exist, false otherwise
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public boolean existsComponentTemplate(ComponentTemplatesExistRequest componentTemplatesRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequest(componentTemplatesRequest,
- ClusterRequestConverters::componentTemplatesExist, options, RestHighLevelClient::convertExistsResponse, emptySet());
+ public boolean existsComponentTemplate(ComponentTemplatesExistRequest componentTemplatesRequest, RequestOptions options)
+ throws IOException {
+ return restHighLevelClient.performRequest(
+ componentTemplatesRequest,
+ ClusterRequestConverters::componentTemplatesExist,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ emptySet()
+ );
}
/**
@@ -280,11 +379,19 @@ public final class ClusterClient {
* @param listener the listener to be notified upon request completion. The listener will be called with the value {@code true}
* @return cancellable that may be used to cancel the request
*/
- public Cancellable existsComponentTemplateAsync(ComponentTemplatesExistRequest componentTemplatesRequest,
- RequestOptions options,
- ActionListener listener) {
+ public Cancellable existsComponentTemplateAsync(
+ ComponentTemplatesExistRequest componentTemplatesRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
- return restHighLevelClient.performRequestAsync(componentTemplatesRequest,
- ClusterRequestConverters::componentTemplatesExist, options, RestHighLevelClient::convertExistsResponse, listener, emptySet());
+ return restHighLevelClient.performRequestAsync(
+ componentTemplatesRequest,
+ ClusterRequestConverters::componentTemplatesExist,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ listener,
+ emptySet()
+ );
}
}
diff --git a/client/rest-high-level/src/main/java/org/opensearch/client/ClusterRequestConverters.java b/client/rest-high-level/src/main/java/org/opensearch/client/ClusterRequestConverters.java
index d593f1c5325..1cf52ac4169 100644
--- a/client/rest-high-level/src/main/java/org/opensearch/client/ClusterRequestConverters.java
+++ b/client/rest-high-level/src/main/java/org/opensearch/client/ClusterRequestConverters.java
@@ -76,14 +76,12 @@ final class ClusterRequestConverters {
static Request clusterHealth(ClusterHealthRequest healthRequest) {
String[] indices = healthRequest.indices() == null ? Strings.EMPTY_ARRAY : healthRequest.indices();
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_cluster/health")
+ String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_cluster/health")
.addCommaSeparatedPathParts(indices)
.build();
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
- RequestConverters.Params params = new RequestConverters.Params()
- .withWaitForStatus(healthRequest.waitForStatus())
+ RequestConverters.Params params = new RequestConverters.Params().withWaitForStatus(healthRequest.waitForStatus())
.withWaitForNoRelocatingShards(healthRequest.waitForNoRelocatingShards())
.withWaitForNoInitializingShards(healthRequest.waitForNoInitializingShards())
.withWaitForActiveShards(healthRequest.waitForActiveShards(), ActiveShardCount.NONE)
@@ -103,7 +101,8 @@ final class ClusterRequestConverters {
static Request putComponentTemplate(PutComponentTemplateRequest putComponentTemplateRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_component_template")
- .addPathPart(putComponentTemplateRequest.name()).build();
+ .addPathPart(putComponentTemplateRequest.name())
+ .build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(putComponentTemplateRequest.masterNodeTimeout());
@@ -118,9 +117,8 @@ final class ClusterRequestConverters {
return request;
}
- static Request getComponentTemplates(GetComponentTemplatesRequest getComponentTemplatesRequest){
- final String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_component_template")
+ static Request getComponentTemplates(GetComponentTemplatesRequest getComponentTemplatesRequest) {
+ final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_component_template")
.addPathPart(getComponentTemplatesRequest.name())
.build();
final Request request = new Request(HttpGet.METHOD_NAME, endpoint);
@@ -132,8 +130,7 @@ final class ClusterRequestConverters {
}
static Request componentTemplatesExist(ComponentTemplatesExistRequest componentTemplatesRequest) {
- final String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_component_template")
+ final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_component_template")
.addPathPart(componentTemplatesRequest.name())
.build();
final Request request = new Request(HttpHead.METHOD_NAME, endpoint);
diff --git a/client/rest-high-level/src/main/java/org/opensearch/client/IndicesClient.java b/client/rest-high-level/src/main/java/org/opensearch/client/IndicesClient.java
index f497dbfd76d..dcff976106b 100644
--- a/client/rest-high-level/src/main/java/org/opensearch/client/IndicesClient.java
+++ b/client/rest-high-level/src/main/java/org/opensearch/client/IndicesClient.java
@@ -32,8 +32,6 @@
package org.opensearch.client;
-import org.opensearch.client.Cancellable;
-import org.opensearch.client.RequestOptions;
import org.opensearch.action.ActionListener;
import org.opensearch.action.admin.indices.alias.IndicesAliasesRequest;
import org.opensearch.action.admin.indices.alias.get.GetAliasesRequest;
@@ -118,8 +116,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public AcknowledgedResponse delete(DeleteIndexRequest deleteIndexRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(deleteIndexRequest, IndicesRequestConverters::deleteIndex, options,
- AcknowledgedResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ deleteIndexRequest,
+ IndicesRequestConverters::deleteIndex,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -130,11 +133,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable deleteAsync(DeleteIndexRequest deleteIndexRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(deleteIndexRequest,
- IndicesRequestConverters::deleteIndex, options,
- AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable deleteAsync(
+ DeleteIndexRequest deleteIndexRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ deleteIndexRequest,
+ IndicesRequestConverters::deleteIndex,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -145,10 +156,14 @@ public final class IndicesClient {
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public CreateIndexResponse create(CreateIndexRequest createIndexRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(createIndexRequest, IndicesRequestConverters::createIndex, options,
- CreateIndexResponse::fromXContent, emptySet());
+ public CreateIndexResponse create(CreateIndexRequest createIndexRequest, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ createIndexRequest,
+ IndicesRequestConverters::createIndex,
+ options,
+ CreateIndexResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -159,11 +174,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable createAsync(CreateIndexRequest createIndexRequest,
- RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(createIndexRequest, IndicesRequestConverters::createIndex, options,
- CreateIndexResponse::fromXContent, listener, emptySet());
+ public Cancellable createAsync(
+ CreateIndexRequest createIndexRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ createIndexRequest,
+ IndicesRequestConverters::createIndex,
+ options,
+ CreateIndexResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -175,10 +198,15 @@ public final class IndicesClient {
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public AcknowledgedResponse createDataStream(CreateDataStreamRequest createDataStreamRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(createDataStreamRequest, IndicesRequestConverters::putDataStream, options,
- AcknowledgedResponse::fromXContent, emptySet());
+ public AcknowledgedResponse createDataStream(CreateDataStreamRequest createDataStreamRequest, RequestOptions options)
+ throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ createDataStreamRequest,
+ IndicesRequestConverters::putDataStream,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -190,11 +218,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable createDataStreamAsync(CreateDataStreamRequest createDataStreamRequest,
- RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(createDataStreamRequest, IndicesRequestConverters::putDataStream,
- options, AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable createDataStreamAsync(
+ CreateDataStreamRequest createDataStreamRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ createDataStreamRequest,
+ IndicesRequestConverters::putDataStream,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -206,10 +242,15 @@ public final class IndicesClient {
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public AcknowledgedResponse deleteDataStream(DeleteDataStreamRequest deleteDataStreamRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(deleteDataStreamRequest, IndicesRequestConverters::deleteDataStream,
- options, AcknowledgedResponse::fromXContent, emptySet());
+ public AcknowledgedResponse deleteDataStream(DeleteDataStreamRequest deleteDataStreamRequest, RequestOptions options)
+ throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ deleteDataStreamRequest,
+ IndicesRequestConverters::deleteDataStream,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -221,10 +262,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable deleteDataStreamAsync(DeleteDataStreamRequest deleteDataStreamRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(deleteDataStreamRequest, IndicesRequestConverters::deleteDataStream,
- options, AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable deleteDataStreamAsync(
+ DeleteDataStreamRequest deleteDataStreamRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ deleteDataStreamRequest,
+ IndicesRequestConverters::deleteDataStream,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -236,8 +286,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public GetDataStreamResponse getDataStream(GetDataStreamRequest dataStreamRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(dataStreamRequest, IndicesRequestConverters::getDataStreams, options,
- GetDataStreamResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ dataStreamRequest,
+ IndicesRequestConverters::getDataStreams,
+ options,
+ GetDataStreamResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -248,10 +303,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable getDataStreamAsync(GetDataStreamRequest dataStreamRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(dataStreamRequest, IndicesRequestConverters::getDataStreams, options,
- GetDataStreamResponse::fromXContent, listener, emptySet());
+ public Cancellable getDataStreamAsync(
+ GetDataStreamRequest dataStreamRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ dataStreamRequest,
+ IndicesRequestConverters::getDataStreams,
+ options,
+ GetDataStreamResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -265,8 +329,13 @@ public final class IndicesClient {
*/
public DataStreamsStatsResponse dataStreamsStats(DataStreamsStatsRequest dataStreamsStatsRequest, RequestOptions options)
throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(dataStreamsStatsRequest, IndicesRequestConverters::dataStreamsStats,
- options, DataStreamsStatsResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ dataStreamsStatsRequest,
+ IndicesRequestConverters::dataStreamsStats,
+ options,
+ DataStreamsStatsResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -278,10 +347,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable dataStreamsStatsAsync(DataStreamsStatsRequest dataStreamsStatsRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(dataStreamsStatsRequest, IndicesRequestConverters::dataStreamsStats,
- options, DataStreamsStatsResponse::fromXContent, listener, emptySet());
+ public Cancellable dataStreamsStatsAsync(
+ DataStreamsStatsRequest dataStreamsStatsRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ dataStreamsStatsRequest,
+ IndicesRequestConverters::dataStreamsStats,
+ options,
+ DataStreamsStatsResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -298,11 +376,16 @@ public final class IndicesClient {
*/
@Deprecated
public org.opensearch.action.admin.indices.create.CreateIndexResponse create(
- org.opensearch.action.admin.indices.create.CreateIndexRequest createIndexRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(createIndexRequest,
- IndicesRequestConverters::createIndex, options,
- org.opensearch.action.admin.indices.create.CreateIndexResponse::fromXContent, emptySet());
+ org.opensearch.action.admin.indices.create.CreateIndexRequest createIndexRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ createIndexRequest,
+ IndicesRequestConverters::createIndex,
+ options,
+ org.opensearch.action.admin.indices.create.CreateIndexResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -318,12 +401,19 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
@Deprecated
- public Cancellable createAsync(org.opensearch.action.admin.indices.create.CreateIndexRequest createIndexRequest,
- RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(createIndexRequest,
- IndicesRequestConverters::createIndex, options,
- org.opensearch.action.admin.indices.create.CreateIndexResponse::fromXContent, listener, emptySet());
+ public Cancellable createAsync(
+ org.opensearch.action.admin.indices.create.CreateIndexRequest createIndexRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ createIndexRequest,
+ IndicesRequestConverters::createIndex,
+ options,
+ org.opensearch.action.admin.indices.create.CreateIndexResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -335,8 +425,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public AcknowledgedResponse putMapping(PutMappingRequest putMappingRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(putMappingRequest, IndicesRequestConverters::putMapping, options,
- AcknowledgedResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ putMappingRequest,
+ IndicesRequestConverters::putMapping,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -347,10 +442,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable putMappingAsync(PutMappingRequest putMappingRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(putMappingRequest, IndicesRequestConverters::putMapping, options,
- AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable putMappingAsync(
+ PutMappingRequest putMappingRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ putMappingRequest,
+ IndicesRequestConverters::putMapping,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -365,10 +469,17 @@ public final class IndicesClient {
* {@link #putMapping(PutMappingRequest, RequestOptions)} should be used instead, which accepts a new request object.
*/
@Deprecated
- public AcknowledgedResponse putMapping(org.opensearch.action.admin.indices.mapping.put.PutMappingRequest putMappingRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(putMappingRequest, IndicesRequestConverters::putMapping, options,
- AcknowledgedResponse::fromXContent, emptySet());
+ public AcknowledgedResponse putMapping(
+ org.opensearch.action.admin.indices.mapping.put.PutMappingRequest putMappingRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ putMappingRequest,
+ IndicesRequestConverters::putMapping,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -384,11 +495,19 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
@Deprecated
- public Cancellable putMappingAsync(org.opensearch.action.admin.indices.mapping.put.PutMappingRequest putMappingRequest,
- RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(putMappingRequest, IndicesRequestConverters::putMapping, options,
- AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable putMappingAsync(
+ org.opensearch.action.admin.indices.mapping.put.PutMappingRequest putMappingRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ putMappingRequest,
+ IndicesRequestConverters::putMapping,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -400,11 +519,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public GetMappingsResponse getMapping(GetMappingsRequest getMappingsRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getMappingsRequest,
+ return restHighLevelClient.performRequestAndParseEntity(
+ getMappingsRequest,
IndicesRequestConverters::getMappings,
options,
GetMappingsResponse::fromXContent,
- emptySet());
+ emptySet()
+ );
}
/**
@@ -415,14 +536,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable getMappingAsync(GetMappingsRequest getMappingsRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(getMappingsRequest,
+ public Cancellable getMappingAsync(
+ GetMappingsRequest getMappingsRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ getMappingsRequest,
IndicesRequestConverters::getMappings,
options,
GetMappingsResponse::fromXContent,
listener,
- emptySet());
+ emptySet()
+ );
}
/**
@@ -439,13 +565,16 @@ public final class IndicesClient {
*/
@Deprecated
public org.opensearch.action.admin.indices.mapping.get.GetMappingsResponse getMapping(
- org.opensearch.action.admin.indices.mapping.get.GetMappingsRequest getMappingsRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getMappingsRequest,
+ org.opensearch.action.admin.indices.mapping.get.GetMappingsRequest getMappingsRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ getMappingsRequest,
IndicesRequestConverters::getMappings,
options,
org.opensearch.action.admin.indices.mapping.get.GetMappingsResponse::fromXContent,
- emptySet());
+ emptySet()
+ );
}
/**
@@ -461,15 +590,19 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
@Deprecated
- public Cancellable getMappingAsync(org.opensearch.action.admin.indices.mapping.get.GetMappingsRequest getMappingsRequest,
- RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(getMappingsRequest,
+ public Cancellable getMappingAsync(
+ org.opensearch.action.admin.indices.mapping.get.GetMappingsRequest getMappingsRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ getMappingsRequest,
IndicesRequestConverters::getMappings,
options,
org.opensearch.action.admin.indices.mapping.get.GetMappingsResponse::fromXContent,
listener,
- emptySet());
+ emptySet()
+ );
}
/**
@@ -486,10 +619,16 @@ public final class IndicesClient {
*/
@Deprecated
public org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsResponse getFieldMapping(
- org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsRequest getFieldMappingsRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getFieldMappingsRequest, IndicesRequestConverters::getFieldMapping,
- options, org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsResponse::fromXContent, emptySet());
+ org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsRequest getFieldMappingsRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ getFieldMappingsRequest,
+ IndicesRequestConverters::getFieldMapping,
+ options,
+ org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -508,11 +647,16 @@ public final class IndicesClient {
public Cancellable getFieldMappingAsync(
org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsRequest getFieldMappingsRequest,
RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(getFieldMappingsRequest,
- IndicesRequestConverters::getFieldMapping, options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ getFieldMappingsRequest,
+ IndicesRequestConverters::getFieldMapping,
+ options,
org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsResponse::fromXContent,
- listener, emptySet());
+ listener,
+ emptySet()
+ );
}
/**
@@ -523,10 +667,14 @@ public final class IndicesClient {
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public GetFieldMappingsResponse getFieldMapping(GetFieldMappingsRequest getFieldMappingsRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getFieldMappingsRequest, IndicesRequestConverters::getFieldMapping,
- options, GetFieldMappingsResponse::fromXContent, emptySet()
+ public GetFieldMappingsResponse getFieldMapping(GetFieldMappingsRequest getFieldMappingsRequest, RequestOptions options)
+ throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ getFieldMappingsRequest,
+ IndicesRequestConverters::getFieldMapping,
+ options,
+ GetFieldMappingsResponse::fromXContent,
+ emptySet()
);
}
@@ -538,11 +686,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable getFieldMappingAsync(GetFieldMappingsRequest getFieldMappingsRequest,
- RequestOptions options, ActionListener listener) {
+ public Cancellable getFieldMappingAsync(
+ GetFieldMappingsRequest getFieldMappingsRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
return restHighLevelClient.performRequestAsyncAndParseEntity(
- getFieldMappingsRequest, IndicesRequestConverters::getFieldMapping, options,
- GetFieldMappingsResponse::fromXContent, listener, emptySet());
+ getFieldMappingsRequest,
+ IndicesRequestConverters::getFieldMapping,
+ options,
+ GetFieldMappingsResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -554,8 +710,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public AcknowledgedResponse updateAliases(IndicesAliasesRequest indicesAliasesRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(indicesAliasesRequest, IndicesRequestConverters::updateAliases, options,
- AcknowledgedResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ indicesAliasesRequest,
+ IndicesRequestConverters::updateAliases,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -566,11 +727,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable updateAliasesAsync(IndicesAliasesRequest indicesAliasesRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(indicesAliasesRequest,
- IndicesRequestConverters::updateAliases, options,
- AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable updateAliasesAsync(
+ IndicesAliasesRequest indicesAliasesRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ indicesAliasesRequest,
+ IndicesRequestConverters::updateAliases,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -582,8 +751,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public OpenIndexResponse open(OpenIndexRequest openIndexRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(openIndexRequest, IndicesRequestConverters::openIndex, options,
- OpenIndexResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ openIndexRequest,
+ IndicesRequestConverters::openIndex,
+ options,
+ OpenIndexResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -595,8 +769,14 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
public Cancellable openAsync(OpenIndexRequest openIndexRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(openIndexRequest, IndicesRequestConverters::openIndex, options,
- OpenIndexResponse::fromXContent, listener, emptySet());
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ openIndexRequest,
+ IndicesRequestConverters::openIndex,
+ options,
+ OpenIndexResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -608,8 +788,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public CloseIndexResponse close(CloseIndexRequest closeIndexRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(closeIndexRequest, IndicesRequestConverters::closeIndex, options,
- CloseIndexResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ closeIndexRequest,
+ IndicesRequestConverters::closeIndex,
+ options,
+ CloseIndexResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -620,14 +805,21 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable closeAsync(CloseIndexRequest closeIndexRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(closeIndexRequest,
- IndicesRequestConverters::closeIndex, options,
- CloseIndexResponse::fromXContent, listener, emptySet());
+ public Cancellable closeAsync(
+ CloseIndexRequest closeIndexRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ closeIndexRequest,
+ IndicesRequestConverters::closeIndex,
+ options,
+ CloseIndexResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
-
/**
* Checks if one or more aliases exist using the Aliases Exist API.
*
@@ -637,8 +829,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request
*/
public boolean existsAlias(GetAliasesRequest getAliasesRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequest(getAliasesRequest, IndicesRequestConverters::existsAlias, options,
- RestHighLevelClient::convertExistsResponse, emptySet());
+ return restHighLevelClient.performRequest(
+ getAliasesRequest,
+ IndicesRequestConverters::existsAlias,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ emptySet()
+ );
}
/**
@@ -650,8 +847,14 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
public Cancellable existsAliasAsync(GetAliasesRequest getAliasesRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsync(getAliasesRequest, IndicesRequestConverters::existsAlias, options,
- RestHighLevelClient::convertExistsResponse, listener, emptySet());
+ return restHighLevelClient.performRequestAsync(
+ getAliasesRequest,
+ IndicesRequestConverters::existsAlias,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ listener,
+ emptySet()
+ );
}
/**
@@ -663,8 +866,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public RefreshResponse refresh(RefreshRequest refreshRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(refreshRequest, IndicesRequestConverters::refresh, options,
- RefreshResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ refreshRequest,
+ IndicesRequestConverters::refresh,
+ options,
+ RefreshResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -676,8 +884,14 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
public Cancellable refreshAsync(RefreshRequest refreshRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(refreshRequest, IndicesRequestConverters::refresh, options,
- RefreshResponse::fromXContent, listener, emptySet());
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ refreshRequest,
+ IndicesRequestConverters::refresh,
+ options,
+ RefreshResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -689,8 +903,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public FlushResponse flush(FlushRequest flushRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(flushRequest, IndicesRequestConverters::flush, options,
- FlushResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ flushRequest,
+ IndicesRequestConverters::flush,
+ options,
+ FlushResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -702,8 +921,14 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
public Cancellable flushAsync(FlushRequest flushRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(flushRequest, IndicesRequestConverters::flush, options,
- FlushResponse::fromXContent, listener, emptySet());
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ flushRequest,
+ IndicesRequestConverters::flush,
+ options,
+ FlushResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -718,8 +943,13 @@ public final class IndicesClient {
*/
@Deprecated
public SyncedFlushResponse flushSynced(SyncedFlushRequest syncedFlushRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(syncedFlushRequest, IndicesRequestConverters::flushSynced, options,
- SyncedFlushResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ syncedFlushRequest,
+ IndicesRequestConverters::flushSynced,
+ options,
+ SyncedFlushResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -733,10 +963,19 @@ public final class IndicesClient {
* Use {@link #flushAsync(FlushRequest, RequestOptions, ActionListener)} instead.
*/
@Deprecated
- public Cancellable flushSyncedAsync(SyncedFlushRequest syncedFlushRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(syncedFlushRequest, IndicesRequestConverters::flushSynced, options,
- SyncedFlushResponse::fromXContent, listener, emptySet());
+ public Cancellable flushSyncedAsync(
+ SyncedFlushRequest syncedFlushRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ syncedFlushRequest,
+ IndicesRequestConverters::flushSynced,
+ options,
+ SyncedFlushResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -748,8 +987,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public GetSettingsResponse getSettings(GetSettingsRequest getSettingsRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getSettingsRequest, IndicesRequestConverters::getSettings, options,
- GetSettingsResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ getSettingsRequest,
+ IndicesRequestConverters::getSettings,
+ options,
+ GetSettingsResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -760,10 +1004,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable getSettingsAsync(GetSettingsRequest getSettingsRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(getSettingsRequest, IndicesRequestConverters::getSettings, options,
- GetSettingsResponse::fromXContent, listener, emptySet());
+ public Cancellable getSettingsAsync(
+ GetSettingsRequest getSettingsRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ getSettingsRequest,
+ IndicesRequestConverters::getSettings,
+ options,
+ GetSettingsResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -775,8 +1028,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public GetIndexResponse get(GetIndexRequest getIndexRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getIndexRequest, IndicesRequestConverters::getIndex, options,
- GetIndexResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ getIndexRequest,
+ IndicesRequestConverters::getIndex,
+ options,
+ GetIndexResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -787,10 +1045,15 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable getAsync(GetIndexRequest getIndexRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(getIndexRequest, IndicesRequestConverters::getIndex, options,
- GetIndexResponse::fromXContent, listener, emptySet());
+ public Cancellable getAsync(GetIndexRequest getIndexRequest, RequestOptions options, ActionListener listener) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ getIndexRequest,
+ IndicesRequestConverters::getIndex,
+ options,
+ GetIndexResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -805,9 +1068,16 @@ public final class IndicesClient {
*/
@Deprecated
public org.opensearch.action.admin.indices.get.GetIndexResponse get(
- org.opensearch.action.admin.indices.get.GetIndexRequest getIndexRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getIndexRequest, IndicesRequestConverters::getIndex, options,
- org.opensearch.action.admin.indices.get.GetIndexResponse::fromXContent, emptySet());
+ org.opensearch.action.admin.indices.get.GetIndexRequest getIndexRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ getIndexRequest,
+ IndicesRequestConverters::getIndex,
+ options,
+ org.opensearch.action.admin.indices.get.GetIndexResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -821,10 +1091,19 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
@Deprecated
- public Cancellable getAsync(org.opensearch.action.admin.indices.get.GetIndexRequest getIndexRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(getIndexRequest, IndicesRequestConverters::getIndex, options,
- org.opensearch.action.admin.indices.get.GetIndexResponse::fromXContent, listener, emptySet());
+ public Cancellable getAsync(
+ org.opensearch.action.admin.indices.get.GetIndexRequest getIndexRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ getIndexRequest,
+ IndicesRequestConverters::getIndex,
+ options,
+ org.opensearch.action.admin.indices.get.GetIndexResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -850,8 +1129,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public ForceMergeResponse forcemerge(ForceMergeRequest forceMergeRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(forceMergeRequest, IndicesRequestConverters::forceMerge, options,
- ForceMergeResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ forceMergeRequest,
+ IndicesRequestConverters::forceMerge,
+ options,
+ ForceMergeResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -864,8 +1148,11 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
@Deprecated
- public Cancellable forceMergeAsync(ForceMergeRequest forceMergeRequest, RequestOptions options,
- ActionListener listener) {
+ public Cancellable forceMergeAsync(
+ ForceMergeRequest forceMergeRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
return forcemergeAsync(forceMergeRequest, options, listener);
}
@@ -877,11 +1164,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable forcemergeAsync(ForceMergeRequest forceMergeRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(forceMergeRequest,
- IndicesRequestConverters::forceMerge, options,
- ForceMergeResponse::fromXContent, listener, emptySet());
+ public Cancellable forcemergeAsync(
+ ForceMergeRequest forceMergeRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ forceMergeRequest,
+ IndicesRequestConverters::forceMerge,
+ options,
+ ForceMergeResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -892,10 +1187,15 @@ public final class IndicesClient {
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public ClearIndicesCacheResponse clearCache(ClearIndicesCacheRequest clearIndicesCacheRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(clearIndicesCacheRequest, IndicesRequestConverters::clearCache, options,
- ClearIndicesCacheResponse::fromXContent, emptySet());
+ public ClearIndicesCacheResponse clearCache(ClearIndicesCacheRequest clearIndicesCacheRequest, RequestOptions options)
+ throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ clearIndicesCacheRequest,
+ IndicesRequestConverters::clearCache,
+ options,
+ ClearIndicesCacheResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -906,11 +1206,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable clearCacheAsync(ClearIndicesCacheRequest clearIndicesCacheRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(clearIndicesCacheRequest,
- IndicesRequestConverters::clearCache, options,
- ClearIndicesCacheResponse::fromXContent, listener, emptySet());
+ public Cancellable clearCacheAsync(
+ ClearIndicesCacheRequest clearIndicesCacheRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ clearIndicesCacheRequest,
+ IndicesRequestConverters::clearCache,
+ options,
+ ClearIndicesCacheResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -941,12 +1249,12 @@ public final class IndicesClient {
*/
public Cancellable existsAsync(GetIndexRequest request, RequestOptions options, ActionListener listener) {
return restHighLevelClient.performRequestAsync(
- request,
- IndicesRequestConverters::indicesExist,
- options,
- RestHighLevelClient::convertExistsResponse,
- listener,
- Collections.emptySet()
+ request,
+ IndicesRequestConverters::indicesExist,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ listener,
+ Collections.emptySet()
);
}
@@ -982,15 +1290,18 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
@Deprecated
- public Cancellable existsAsync(org.opensearch.action.admin.indices.get.GetIndexRequest request, RequestOptions options,
- ActionListener listener) {
+ public Cancellable existsAsync(
+ org.opensearch.action.admin.indices.get.GetIndexRequest request,
+ RequestOptions options,
+ ActionListener listener
+ ) {
return restHighLevelClient.performRequestAsync(
- request,
- IndicesRequestConverters::indicesExist,
- options,
- RestHighLevelClient::convertExistsResponse,
- listener,
- Collections.emptySet()
+ request,
+ IndicesRequestConverters::indicesExist,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ listener,
+ Collections.emptySet()
);
}
@@ -1003,8 +1314,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public ResizeResponse shrink(ResizeRequest resizeRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(resizeRequest, IndicesRequestConverters::shrink, options,
- ResizeResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ resizeRequest,
+ IndicesRequestConverters::shrink,
+ options,
+ ResizeResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1018,9 +1334,16 @@ public final class IndicesClient {
*/
@Deprecated
public org.opensearch.action.admin.indices.shrink.ResizeResponse shrink(
- org.opensearch.action.admin.indices.shrink.ResizeRequest resizeRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(resizeRequest, IndicesRequestConverters::shrink, options,
- org.opensearch.action.admin.indices.shrink.ResizeResponse::fromXContent, emptySet());
+ org.opensearch.action.admin.indices.shrink.ResizeRequest resizeRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ resizeRequest,
+ IndicesRequestConverters::shrink,
+ options,
+ org.opensearch.action.admin.indices.shrink.ResizeResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1032,8 +1355,14 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
public Cancellable shrinkAsync(ResizeRequest resizeRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, IndicesRequestConverters::shrink, options,
- ResizeResponse::fromXContent, listener, emptySet());
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ resizeRequest,
+ IndicesRequestConverters::shrink,
+ options,
+ ResizeResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1046,10 +1375,19 @@ public final class IndicesClient {
* @deprecated use {@link #shrinkAsync(ResizeRequest, RequestOptions, ActionListener)}
*/
@Deprecated
- public Cancellable shrinkAsync(org.opensearch.action.admin.indices.shrink.ResizeRequest resizeRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, IndicesRequestConverters::shrink, options,
- org.opensearch.action.admin.indices.shrink.ResizeResponse::fromXContent, listener, emptySet());
+ public Cancellable shrinkAsync(
+ org.opensearch.action.admin.indices.shrink.ResizeRequest resizeRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ resizeRequest,
+ IndicesRequestConverters::shrink,
+ options,
+ org.opensearch.action.admin.indices.shrink.ResizeResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1061,8 +1399,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public ResizeResponse split(ResizeRequest resizeRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(resizeRequest, IndicesRequestConverters::split, options,
- ResizeResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ resizeRequest,
+ IndicesRequestConverters::split,
+ options,
+ ResizeResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1076,9 +1419,16 @@ public final class IndicesClient {
*/
@Deprecated
public org.opensearch.action.admin.indices.shrink.ResizeResponse split(
- org.opensearch.action.admin.indices.shrink.ResizeRequest resizeRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(resizeRequest, IndicesRequestConverters::split, options,
- org.opensearch.action.admin.indices.shrink.ResizeResponse::fromXContent, emptySet());
+ org.opensearch.action.admin.indices.shrink.ResizeRequest resizeRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ resizeRequest,
+ IndicesRequestConverters::split,
+ options,
+ org.opensearch.action.admin.indices.shrink.ResizeResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1090,8 +1440,14 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
public Cancellable splitAsync(ResizeRequest resizeRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, IndicesRequestConverters::split, options,
- ResizeResponse::fromXContent, listener, emptySet());
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ resizeRequest,
+ IndicesRequestConverters::split,
+ options,
+ ResizeResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1104,10 +1460,19 @@ public final class IndicesClient {
* @deprecated use {@link #splitAsync(ResizeRequest, RequestOptions, ActionListener)}
*/
@Deprecated
- public Cancellable splitAsync(org.opensearch.action.admin.indices.shrink.ResizeRequest resizeRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, IndicesRequestConverters::split, options,
- org.opensearch.action.admin.indices.shrink.ResizeResponse::fromXContent, listener, emptySet());
+ public Cancellable splitAsync(
+ org.opensearch.action.admin.indices.shrink.ResizeRequest resizeRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ resizeRequest,
+ IndicesRequestConverters::split,
+ options,
+ org.opensearch.action.admin.indices.shrink.ResizeResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1119,8 +1484,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public ResizeResponse clone(ResizeRequest resizeRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(resizeRequest, IndicesRequestConverters::clone, options,
- ResizeResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ resizeRequest,
+ IndicesRequestConverters::clone,
+ options,
+ ResizeResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1134,9 +1504,16 @@ public final class IndicesClient {
*/
@Deprecated
public org.opensearch.action.admin.indices.shrink.ResizeResponse clone(
- org.opensearch.action.admin.indices.shrink.ResizeRequest resizeRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(resizeRequest, IndicesRequestConverters::clone, options,
- org.opensearch.action.admin.indices.shrink.ResizeResponse::fromXContent, emptySet());
+ org.opensearch.action.admin.indices.shrink.ResizeRequest resizeRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ resizeRequest,
+ IndicesRequestConverters::clone,
+ options,
+ org.opensearch.action.admin.indices.shrink.ResizeResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1148,8 +1525,14 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
public Cancellable cloneAsync(ResizeRequest resizeRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, IndicesRequestConverters::clone, options,
- ResizeResponse::fromXContent, listener, emptySet());
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ resizeRequest,
+ IndicesRequestConverters::clone,
+ options,
+ ResizeResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1162,10 +1545,19 @@ public final class IndicesClient {
* @deprecated use {@link #cloneAsync(ResizeRequest, RequestOptions, ActionListener)}
*/
@Deprecated
- public Cancellable cloneAsync(org.opensearch.action.admin.indices.shrink.ResizeRequest resizeRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(resizeRequest, IndicesRequestConverters::clone, options,
- org.opensearch.action.admin.indices.shrink.ResizeResponse::fromXContent, listener, emptySet());
+ public Cancellable cloneAsync(
+ org.opensearch.action.admin.indices.shrink.ResizeRequest resizeRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ resizeRequest,
+ IndicesRequestConverters::clone,
+ options,
+ org.opensearch.action.admin.indices.shrink.ResizeResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1177,8 +1569,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public RolloverResponse rollover(RolloverRequest rolloverRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(rolloverRequest, IndicesRequestConverters::rollover, options,
- RolloverResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ rolloverRequest,
+ IndicesRequestConverters::rollover,
+ options,
+ RolloverResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1190,11 +1587,16 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
public Cancellable rolloverAsync(RolloverRequest rolloverRequest, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(rolloverRequest, IndicesRequestConverters::rollover, options,
- RolloverResponse::fromXContent, listener, emptySet());
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ rolloverRequest,
+ IndicesRequestConverters::rollover,
+ options,
+ RolloverResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
-
/**
* Rolls over an index using the Rollover Index API.
*
@@ -1208,10 +1610,16 @@ public final class IndicesClient {
*/
@Deprecated
public org.opensearch.action.admin.indices.rollover.RolloverResponse rollover(
- org.opensearch.action.admin.indices.rollover.RolloverRequest rolloverRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(rolloverRequest, IndicesRequestConverters::rollover, options,
- org.opensearch.action.admin.indices.rollover.RolloverResponse::fromXContent, emptySet());
+ org.opensearch.action.admin.indices.rollover.RolloverRequest rolloverRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ rolloverRequest,
+ IndicesRequestConverters::rollover,
+ options,
+ org.opensearch.action.admin.indices.rollover.RolloverResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1227,11 +1635,19 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
@Deprecated
- public Cancellable rolloverAsync(org.opensearch.action.admin.indices.rollover.RolloverRequest rolloverRequest,
- RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(rolloverRequest, IndicesRequestConverters::rollover, options,
- org.opensearch.action.admin.indices.rollover.RolloverResponse::fromXContent, listener, emptySet());
+ public Cancellable rolloverAsync(
+ org.opensearch.action.admin.indices.rollover.RolloverRequest rolloverRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ rolloverRequest,
+ IndicesRequestConverters::rollover,
+ options,
+ org.opensearch.action.admin.indices.rollover.RolloverResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1243,8 +1659,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public GetAliasesResponse getAlias(GetAliasesRequest getAliasesRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getAliasesRequest, IndicesRequestConverters::getAlias, options,
- GetAliasesResponse::fromXContent, singleton(RestStatus.NOT_FOUND.getStatus()));
+ return restHighLevelClient.performRequestAndParseEntity(
+ getAliasesRequest,
+ IndicesRequestConverters::getAlias,
+ options,
+ GetAliasesResponse::fromXContent,
+ singleton(RestStatus.NOT_FOUND.getStatus())
+ );
}
/**
@@ -1255,11 +1676,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable getAliasAsync(GetAliasesRequest getAliasesRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(getAliasesRequest,
- IndicesRequestConverters::getAlias, options,
- GetAliasesResponse::fromXContent, listener, singleton(RestStatus.NOT_FOUND.getStatus()));
+ public Cancellable getAliasAsync(
+ GetAliasesRequest getAliasesRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ getAliasesRequest,
+ IndicesRequestConverters::getAlias,
+ options,
+ GetAliasesResponse::fromXContent,
+ listener,
+ singleton(RestStatus.NOT_FOUND.getStatus())
+ );
}
/**
@@ -1271,8 +1700,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public AcknowledgedResponse putSettings(UpdateSettingsRequest updateSettingsRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(updateSettingsRequest, IndicesRequestConverters::indexPutSettings, options,
- AcknowledgedResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ updateSettingsRequest,
+ IndicesRequestConverters::indexPutSettings,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1283,14 +1717,21 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable putSettingsAsync(UpdateSettingsRequest updateSettingsRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(updateSettingsRequest,
- IndicesRequestConverters::indexPutSettings, options,
- AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable putSettingsAsync(
+ UpdateSettingsRequest updateSettingsRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ updateSettingsRequest,
+ IndicesRequestConverters::indexPutSettings,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
-
/**
* Puts an index template using the Index Templates API.
*
@@ -1303,10 +1744,16 @@ public final class IndicesClient {
*/
@Deprecated
public AcknowledgedResponse putTemplate(
- org.opensearch.action.admin.indices.template.put.PutIndexTemplateRequest putIndexTemplateRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(putIndexTemplateRequest, IndicesRequestConverters::putTemplate, options,
- AcknowledgedResponse::fromXContent, emptySet());
+ org.opensearch.action.admin.indices.template.put.PutIndexTemplateRequest putIndexTemplateRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ putIndexTemplateRequest,
+ IndicesRequestConverters::putTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1322,14 +1769,20 @@ public final class IndicesClient {
*/
@Deprecated
public Cancellable putTemplateAsync(
- org.opensearch.action.admin.indices.template.put.PutIndexTemplateRequest putIndexTemplateRequest,
- RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(putIndexTemplateRequest,
- IndicesRequestConverters::putTemplate, options,
- AcknowledgedResponse::fromXContent, listener, emptySet());
+ org.opensearch.action.admin.indices.template.put.PutIndexTemplateRequest putIndexTemplateRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ putIndexTemplateRequest,
+ IndicesRequestConverters::putTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
-
/**
* Puts an index template using the Index Templates API.
*
@@ -1338,11 +1791,14 @@ public final class IndicesClient {
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public AcknowledgedResponse putTemplate(
- PutIndexTemplateRequest putIndexTemplateRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(putIndexTemplateRequest, IndicesRequestConverters::putTemplate, options,
- AcknowledgedResponse::fromXContent, emptySet());
+ public AcknowledgedResponse putTemplate(PutIndexTemplateRequest putIndexTemplateRequest, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ putIndexTemplateRequest,
+ IndicesRequestConverters::putTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1353,11 +1809,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable putTemplateAsync(PutIndexTemplateRequest putIndexTemplateRequest,
- RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(putIndexTemplateRequest,
- IndicesRequestConverters::putTemplate, options,
- AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable putTemplateAsync(
+ PutIndexTemplateRequest putIndexTemplateRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ putIndexTemplateRequest,
+ IndicesRequestConverters::putTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1370,8 +1834,13 @@ public final class IndicesClient {
*/
public AcknowledgedResponse putIndexTemplate(PutComposableIndexTemplateRequest putIndexTemplateRequest, RequestOptions options)
throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(putIndexTemplateRequest, IndicesRequestConverters::putIndexTemplate,
- options, AcknowledgedResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ putIndexTemplateRequest,
+ IndicesRequestConverters::putIndexTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1382,10 +1851,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable putIndexTemplateAsync(PutComposableIndexTemplateRequest putIndexTemplateRequest,
- RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(putIndexTemplateRequest, IndicesRequestConverters::putIndexTemplate,
- options, AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable putIndexTemplateAsync(
+ PutComposableIndexTemplateRequest putIndexTemplateRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ putIndexTemplateRequest,
+ IndicesRequestConverters::putIndexTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1398,10 +1876,17 @@ public final class IndicesClient {
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public SimulateIndexTemplateResponse simulateIndexTemplate(SimulateIndexTemplateRequest simulateIndexTemplateRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(simulateIndexTemplateRequest,
- IndicesRequestConverters::simulateIndexTemplate, options, SimulateIndexTemplateResponse::fromXContent, emptySet());
+ public SimulateIndexTemplateResponse simulateIndexTemplate(
+ SimulateIndexTemplateRequest simulateIndexTemplateRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ simulateIndexTemplateRequest,
+ IndicesRequestConverters::simulateIndexTemplate,
+ options,
+ SimulateIndexTemplateResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1413,10 +1898,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable simulateIndexTemplateAsync(SimulateIndexTemplateRequest simulateIndexTemplateRequest,
- RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(simulateIndexTemplateRequest,
- IndicesRequestConverters::simulateIndexTemplate, options, SimulateIndexTemplateResponse::fromXContent, listener, emptySet());
+ public Cancellable simulateIndexTemplateAsync(
+ SimulateIndexTemplateRequest simulateIndexTemplateRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ simulateIndexTemplateRequest,
+ IndicesRequestConverters::simulateIndexTemplate,
+ options,
+ SimulateIndexTemplateResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1428,11 +1922,14 @@ public final class IndicesClient {
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public ValidateQueryResponse validateQuery(ValidateQueryRequest validateQueryRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(validateQueryRequest,
- IndicesRequestConverters::validateQuery, options,
- ValidateQueryResponse::fromXContent, emptySet());
+ public ValidateQueryResponse validateQuery(ValidateQueryRequest validateQueryRequest, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ validateQueryRequest,
+ IndicesRequestConverters::validateQuery,
+ options,
+ ValidateQueryResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1444,11 +1941,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable validateQueryAsync(ValidateQueryRequest validateQueryRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(validateQueryRequest,
- IndicesRequestConverters::validateQuery, options,
- ValidateQueryResponse::fromXContent, listener, emptySet());
+ public Cancellable validateQueryAsync(
+ ValidateQueryRequest validateQueryRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ validateQueryRequest,
+ IndicesRequestConverters::validateQuery,
+ options,
+ ValidateQueryResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1464,11 +1969,16 @@ public final class IndicesClient {
*/
@Deprecated
public org.opensearch.action.admin.indices.template.get.GetIndexTemplatesResponse getTemplate(
- GetIndexTemplatesRequest getIndexTemplatesRequest, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getIndexTemplatesRequest,
+ GetIndexTemplatesRequest getIndexTemplatesRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ getIndexTemplatesRequest,
IndicesRequestConverters::getTemplatesWithDocumentTypes,
options,
- org.opensearch.action.admin.indices.template.get.GetIndexTemplatesResponse::fromXContent, emptySet());
+ org.opensearch.action.admin.indices.template.get.GetIndexTemplatesResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1479,10 +1989,17 @@ public final class IndicesClient {
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public GetComposableIndexTemplatesResponse getIndexTemplate(GetComposableIndexTemplateRequest getIndexTemplatesRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getIndexTemplatesRequest, IndicesRequestConverters::getIndexTemplates,
- options, GetComposableIndexTemplatesResponse::fromXContent, emptySet());
+ public GetComposableIndexTemplatesResponse getIndexTemplate(
+ GetComposableIndexTemplateRequest getIndexTemplatesRequest,
+ RequestOptions options
+ ) throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ getIndexTemplatesRequest,
+ IndicesRequestConverters::getIndexTemplates,
+ options,
+ GetComposableIndexTemplatesResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1493,10 +2010,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable getIndexTemplateAsync(GetComposableIndexTemplateRequest getIndexTemplatesRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(getIndexTemplatesRequest,
- IndicesRequestConverters::getIndexTemplates, options, GetComposableIndexTemplatesResponse::fromXContent, listener, emptySet());
+ public Cancellable getIndexTemplateAsync(
+ GetComposableIndexTemplateRequest getIndexTemplatesRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ getIndexTemplatesRequest,
+ IndicesRequestConverters::getIndexTemplates,
+ options,
+ GetComposableIndexTemplatesResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1507,11 +2033,15 @@ public final class IndicesClient {
* @return the response
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public GetIndexTemplatesResponse getIndexTemplate(GetIndexTemplatesRequest getIndexTemplatesRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(getIndexTemplatesRequest,
+ public GetIndexTemplatesResponse getIndexTemplate(GetIndexTemplatesRequest getIndexTemplatesRequest, RequestOptions options)
+ throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ getIndexTemplatesRequest,
IndicesRequestConverters::getTemplates,
- options, GetIndexTemplatesResponse::fromXContent, emptySet());
+ options,
+ GetIndexTemplatesResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1526,13 +2056,19 @@ public final class IndicesClient {
* @return cancellable that may be used to cancel the request
*/
@Deprecated
- public Cancellable getTemplateAsync(GetIndexTemplatesRequest getIndexTemplatesRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(getIndexTemplatesRequest,
+ public Cancellable getTemplateAsync(
+ GetIndexTemplatesRequest getIndexTemplatesRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ getIndexTemplatesRequest,
IndicesRequestConverters::getTemplatesWithDocumentTypes,
options,
org.opensearch.action.admin.indices.template.get.GetIndexTemplatesResponse::fromXContent,
- listener, emptySet());
+ listener,
+ emptySet()
+ );
}
/**
@@ -1543,11 +2079,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable getIndexTemplateAsync(GetIndexTemplatesRequest getIndexTemplatesRequest, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(getIndexTemplatesRequest,
+ public Cancellable getIndexTemplateAsync(
+ GetIndexTemplatesRequest getIndexTemplatesRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ getIndexTemplatesRequest,
IndicesRequestConverters::getTemplates,
- options, GetIndexTemplatesResponse::fromXContent, listener, emptySet());
+ options,
+ GetIndexTemplatesResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1558,11 +2102,14 @@ public final class IndicesClient {
* @return true if any index templates in the request exist, false otherwise
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public boolean existsTemplate(IndexTemplatesExistRequest indexTemplatesRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequest(indexTemplatesRequest,
- IndicesRequestConverters::templatesExist, options,
- RestHighLevelClient::convertExistsResponse, emptySet());
+ public boolean existsTemplate(IndexTemplatesExistRequest indexTemplatesRequest, RequestOptions options) throws IOException {
+ return restHighLevelClient.performRequest(
+ indexTemplatesRequest,
+ IndicesRequestConverters::templatesExist,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ emptySet()
+ );
}
/**
@@ -1572,13 +2119,20 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion. The listener will be called with the value {@code true}
* @return cancellable that may be used to cancel the request
*/
- public Cancellable existsTemplateAsync(IndexTemplatesExistRequest indexTemplatesExistRequest,
- RequestOptions options,
- ActionListener listener) {
+ public Cancellable existsTemplateAsync(
+ IndexTemplatesExistRequest indexTemplatesExistRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
- return restHighLevelClient.performRequestAsync(indexTemplatesExistRequest,
- IndicesRequestConverters::templatesExist, options,
- RestHighLevelClient::convertExistsResponse, listener, emptySet());
+ return restHighLevelClient.performRequestAsync(
+ indexTemplatesExistRequest,
+ IndicesRequestConverters::templatesExist,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1589,11 +2143,15 @@ public final class IndicesClient {
* @return true if any index templates in the request exist, false otherwise
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public boolean existsIndexTemplate(ComposableIndexTemplateExistRequest indexTemplatesRequest,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequest(indexTemplatesRequest,
- IndicesRequestConverters::templatesExist, options,
- RestHighLevelClient::convertExistsResponse, emptySet());
+ public boolean existsIndexTemplate(ComposableIndexTemplateExistRequest indexTemplatesRequest, RequestOptions options)
+ throws IOException {
+ return restHighLevelClient.performRequest(
+ indexTemplatesRequest,
+ IndicesRequestConverters::templatesExist,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ emptySet()
+ );
}
/**
@@ -1603,13 +2161,20 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion. The listener will be called with the value {@code true}
* @return cancellable that may be used to cancel the request
*/
- public Cancellable existsIndexTemplateAsync(ComposableIndexTemplateExistRequest indexTemplatesExistRequest,
- RequestOptions options,
- ActionListener listener) {
+ public Cancellable existsIndexTemplateAsync(
+ ComposableIndexTemplateExistRequest indexTemplatesExistRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
- return restHighLevelClient.performRequestAsync(indexTemplatesExistRequest,
- IndicesRequestConverters::templatesExist, options,
- RestHighLevelClient::convertExistsResponse, listener, emptySet());
+ return restHighLevelClient.performRequestAsync(
+ indexTemplatesExistRequest,
+ IndicesRequestConverters::templatesExist,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1619,8 +2184,13 @@ public final class IndicesClient {
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
*/
public AnalyzeResponse analyze(AnalyzeRequest request, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request, IndicesRequestConverters::analyze, options,
- AnalyzeResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ request,
+ IndicesRequestConverters::analyze,
+ options,
+ AnalyzeResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1631,10 +2201,15 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable analyzeAsync(AnalyzeRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request, IndicesRequestConverters::analyze, options,
- AnalyzeResponse::fromXContent, listener, emptySet());
+ public Cancellable analyzeAsync(AnalyzeRequest request, RequestOptions options, ActionListener listener) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ request,
+ IndicesRequestConverters::analyze,
+ options,
+ AnalyzeResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1645,8 +2220,13 @@ public final class IndicesClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public AcknowledgedResponse deleteTemplate(DeleteIndexTemplateRequest request, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request, IndicesRequestConverters::deleteTemplate,
- options, AcknowledgedResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ request,
+ IndicesRequestConverters::deleteTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1657,10 +2237,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable deleteTemplateAsync(DeleteIndexTemplateRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request, IndicesRequestConverters::deleteTemplate,
- options, AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable deleteTemplateAsync(
+ DeleteIndexTemplateRequest request,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ request,
+ IndicesRequestConverters::deleteTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1670,10 +2259,15 @@ public final class IndicesClient {
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
- public AcknowledgedResponse deleteIndexTemplate(DeleteComposableIndexTemplateRequest request,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request, IndicesRequestConverters::deleteIndexTemplate,
- options, AcknowledgedResponse::fromXContent, emptySet());
+ public AcknowledgedResponse deleteIndexTemplate(DeleteComposableIndexTemplateRequest request, RequestOptions options)
+ throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ request,
+ IndicesRequestConverters::deleteIndexTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1684,10 +2278,19 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable deleteIndexTemplateAsync(DeleteComposableIndexTemplateRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request, IndicesRequestConverters::deleteIndexTemplate,
- options, AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable deleteIndexTemplateAsync(
+ DeleteComposableIndexTemplateRequest request,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ request,
+ IndicesRequestConverters::deleteIndexTemplate,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1695,10 +2298,15 @@ public final class IndicesClient {
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
*/
- public org.opensearch.client.core.AcknowledgedResponse deleteAlias(DeleteAliasRequest request,
- RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity(request, IndicesRequestConverters::deleteAlias, options,
- org.opensearch.client.core.AcknowledgedResponse::fromXContent, emptySet());
+ public org.opensearch.client.core.AcknowledgedResponse deleteAlias(DeleteAliasRequest request, RequestOptions options)
+ throws IOException {
+ return restHighLevelClient.performRequestAndParseEntity(
+ request,
+ IndicesRequestConverters::deleteAlias,
+ options,
+ org.opensearch.client.core.AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1708,9 +2316,18 @@ public final class IndicesClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable deleteAliasAsync(DeleteAliasRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity(request, IndicesRequestConverters::deleteAlias, options,
- org.opensearch.client.core.AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable deleteAliasAsync(
+ DeleteAliasRequest request,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ request,
+ IndicesRequestConverters::deleteAlias,
+ options,
+ org.opensearch.client.core.AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
}
diff --git a/client/rest-high-level/src/main/java/org/opensearch/client/IndicesRequestConverters.java b/client/rest-high-level/src/main/java/org/opensearch/client/IndicesRequestConverters.java
index 9a4089120b8..920b7343ddc 100644
--- a/client/rest-high-level/src/main/java/org/opensearch/client/IndicesRequestConverters.java
+++ b/client/rest-high-level/src/main/java/org/opensearch/client/IndicesRequestConverters.java
@@ -37,7 +37,6 @@ import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpHead;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
-import org.opensearch.client.Request;
import org.opensearch.action.admin.indices.alias.IndicesAliasesRequest;
import org.opensearch.action.admin.indices.alias.get.GetAliasesRequest;
import org.opensearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
@@ -88,7 +87,8 @@ final class IndicesRequestConverters {
static Request putDataStream(CreateDataStreamRequest createDataStreamRequest) {
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_data_stream")
- .addPathPart(createDataStreamRequest.getName()).build();
+ .addPathPart(createDataStreamRequest.getName())
+ .build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
return request;
}
@@ -101,8 +101,7 @@ final class IndicesRequestConverters {
}
static Request getDataStreams(GetDataStreamRequest dataStreamRequest) {
- final String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_data_stream")
+ final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_data_stream")
.addPathPart(dataStreamRequest.getName())
.build();
return new Request(HttpGet.METHOD_NAME, endpoint);
@@ -110,8 +109,7 @@ final class IndicesRequestConverters {
static Request dataStreamsStats(DataStreamsStatsRequest dataStreamsStatsRequest) {
String[] expressions = dataStreamsStatsRequest.indices() == null ? Strings.EMPTY_ARRAY : dataStreamsStatsRequest.indices();
- final String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_data_stream")
+ final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_data_stream")
.addCommaSeparatedPathParts(expressions)
.addPathPartAsIs("_stats")
.build();
@@ -156,8 +154,7 @@ final class IndicesRequestConverters {
}
static Request createIndex(CreateIndexRequest createIndexRequest) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPart(createIndexRequest.index()).build();
+ String endpoint = new RequestConverters.EndpointBuilder().addPathPart(createIndexRequest.index()).build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
@@ -169,8 +166,7 @@ final class IndicesRequestConverters {
return request;
}
- static Request createIndex(org.opensearch.action.admin.indices.create.CreateIndexRequest createIndexRequest)
- throws IOException {
+ static Request createIndex(org.opensearch.action.admin.indices.create.CreateIndexRequest createIndexRequest) throws IOException {
String endpoint = RequestConverters.endpoint(createIndexRequest.indices());
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
@@ -195,7 +191,6 @@ final class IndicesRequestConverters {
return request;
}
-
static Request putMapping(PutMappingRequest putMappingRequest) throws IOException {
Request request = new Request(HttpPut.METHOD_NAME, RequestConverters.endpoint(putMappingRequest.indices(), "_mapping"));
@@ -219,8 +214,10 @@ final class IndicesRequestConverters {
throw new IllegalArgumentException("concreteIndex cannot be set on PutMapping requests made over the REST API");
}
- Request request = new Request(HttpPut.METHOD_NAME, RequestConverters.endpoint(putMappingRequest.indices(),
- "_mapping", putMappingRequest.type()));
+ Request request = new Request(
+ HttpPut.METHOD_NAME,
+ RequestConverters.endpoint(putMappingRequest.indices(), "_mapping", putMappingRequest.type())
+ );
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(putMappingRequest.timeout());
@@ -264,8 +261,7 @@ final class IndicesRequestConverters {
String[] indices = getFieldMappingsRequest.indices() == null ? Strings.EMPTY_ARRAY : getFieldMappingsRequest.indices();
String[] fields = getFieldMappingsRequest.fields() == null ? Strings.EMPTY_ARRAY : getFieldMappingsRequest.fields();
- String endpoint = new RequestConverters.EndpointBuilder()
- .addCommaSeparatedPathParts(indices)
+ String endpoint = new RequestConverters.EndpointBuilder().addCommaSeparatedPathParts(indices)
.addPathPartAsIs("_mapping")
.addPathPartAsIs("field")
.addCommaSeparatedPathParts(fields)
@@ -287,8 +283,10 @@ final class IndicesRequestConverters {
String[] fields = getFieldMappingsRequest.fields() == null ? Strings.EMPTY_ARRAY : getFieldMappingsRequest.fields();
String endpoint = new RequestConverters.EndpointBuilder().addCommaSeparatedPathParts(indices)
- .addPathPartAsIs("_mapping").addCommaSeparatedPathParts(types)
- .addPathPartAsIs("field").addCommaSeparatedPathParts(fields)
+ .addPathPartAsIs("_mapping")
+ .addCommaSeparatedPathParts(types)
+ .addPathPartAsIs("field")
+ .addCommaSeparatedPathParts(fields)
.build();
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
@@ -347,7 +345,7 @@ final class IndicesRequestConverters {
}
static Request clearCache(ClearIndicesCacheRequest clearIndicesCacheRequest) {
- String[] indices = clearIndicesCacheRequest.indices() == null ? Strings.EMPTY_ARRAY :clearIndicesCacheRequest.indices();
+ String[] indices = clearIndicesCacheRequest.indices() == null ? Strings.EMPTY_ARRAY : clearIndicesCacheRequest.indices();
Request request = new Request(HttpPost.METHOD_NAME, RequestConverters.endpoint(indices, "_cache/clear"));
RequestConverters.Params parameters = new RequestConverters.Params();
@@ -361,8 +359,8 @@ final class IndicesRequestConverters {
}
static Request existsAlias(GetAliasesRequest getAliasesRequest) {
- if ((getAliasesRequest.indices() == null || getAliasesRequest.indices().length == 0) &&
- (getAliasesRequest.aliases() == null || getAliasesRequest.aliases().length == 0)) {
+ if ((getAliasesRequest.indices() == null || getAliasesRequest.indices().length == 0)
+ && (getAliasesRequest.aliases() == null || getAliasesRequest.aliases().length == 0)) {
throw new IllegalArgumentException("existsAlias requires at least an alias or an index");
}
String[] indices = getAliasesRequest.indices() == null ? Strings.EMPTY_ARRAY : getAliasesRequest.indices();
@@ -418,8 +416,9 @@ final class IndicesRequestConverters {
private static Request resize(ResizeRequest resizeRequest, ResizeType type) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder().addPathPart(resizeRequest.getSourceIndex())
- .addPathPartAsIs("_" + type.name().toLowerCase(Locale.ROOT))
- .addPathPart(resizeRequest.getTargetIndex()).build();
+ .addPathPartAsIs("_" + type.name().toLowerCase(Locale.ROOT))
+ .addPathPart(resizeRequest.getTargetIndex())
+ .build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
@@ -435,7 +434,8 @@ final class IndicesRequestConverters {
private static Request resize(org.opensearch.action.admin.indices.shrink.ResizeRequest resizeRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder().addPathPart(resizeRequest.getSourceIndex())
.addPathPartAsIs("_" + resizeRequest.getResizeType().name().toLowerCase(Locale.ROOT))
- .addPathPart(resizeRequest.getTargetIndexRequest().index()).build();
+ .addPathPart(resizeRequest.getTargetIndexRequest().index())
+ .build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
@@ -448,8 +448,10 @@ final class IndicesRequestConverters {
}
static Request rollover(RolloverRequest rolloverRequest) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder().addPathPart(rolloverRequest.getAlias()).addPathPartAsIs("_rollover")
- .addPathPart(rolloverRequest.getNewIndexName()).build();
+ String endpoint = new RequestConverters.EndpointBuilder().addPathPart(rolloverRequest.getAlias())
+ .addPathPartAsIs("_rollover")
+ .addPathPart(rolloverRequest.getNewIndexName())
+ .build();
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
@@ -467,7 +469,9 @@ final class IndicesRequestConverters {
@Deprecated
static Request rollover(org.opensearch.action.admin.indices.rollover.RolloverRequest rolloverRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder().addPathPart(rolloverRequest.getRolloverTarget())
- .addPathPartAsIs("_rollover").addPathPart(rolloverRequest.getNewIndexName()).build();
+ .addPathPartAsIs("_rollover")
+ .addPathPart(rolloverRequest.getNewIndexName())
+ .build();
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
@@ -597,9 +601,10 @@ final class IndicesRequestConverters {
*/
@Deprecated
static Request putTemplate(org.opensearch.action.admin.indices.template.put.PutIndexTemplateRequest putIndexTemplateRequest)
- throws IOException {
+ throws IOException {
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_template")
- .addPathPart(putIndexTemplateRequest.name()).build();
+ .addPathPart(putIndexTemplateRequest.name())
+ .build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(putIndexTemplateRequest.masterNodeTimeout());
@@ -617,7 +622,8 @@ final class IndicesRequestConverters {
static Request putTemplate(PutIndexTemplateRequest putIndexTemplateRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_template")
- .addPathPart(putIndexTemplateRequest.name()).build();
+ .addPathPart(putIndexTemplateRequest.name())
+ .build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(putIndexTemplateRequest.masterNodeTimeout());
@@ -634,7 +640,8 @@ final class IndicesRequestConverters {
static Request putIndexTemplate(PutComposableIndexTemplateRequest putIndexTemplateRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_index_template")
- .addPathPart(putIndexTemplateRequest.name()).build();
+ .addPathPart(putIndexTemplateRequest.name())
+ .build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(putIndexTemplateRequest.masterNodeTimeout());
@@ -651,7 +658,8 @@ final class IndicesRequestConverters {
static Request simulateIndexTemplate(SimulateIndexTemplateRequest simulateIndexTemplateRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_index_template", "_simulate_index")
- .addPathPart(simulateIndexTemplateRequest.indexName()).build();
+ .addPathPart(simulateIndexTemplateRequest.indexName())
+ .build();
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
RequestConverters.Params params = new RequestConverters.Params();
params.withMasterTimeout(simulateIndexTemplateRequest.masterNodeTimeout());
@@ -663,8 +671,9 @@ final class IndicesRequestConverters {
if (Strings.hasText(putComposableIndexTemplateRequest.cause())) {
params.putParam("cause", putComposableIndexTemplateRequest.cause());
}
- request.setEntity(RequestConverters.createEntity(putComposableIndexTemplateRequest,
- RequestConverters.REQUEST_BODY_CONTENT_TYPE));
+ request.setEntity(
+ RequestConverters.createEntity(putComposableIndexTemplateRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE)
+ );
}
request.addParameters(params.asMap());
return request;
@@ -707,8 +716,7 @@ final class IndicesRequestConverters {
}
private static Request getTemplates(GetIndexTemplatesRequest getIndexTemplatesRequest, boolean includeTypeName) {
- final String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_template")
+ final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_template")
.addCommaSeparatedPathParts(getIndexTemplatesRequest.names())
.build();
final Request request = new Request(HttpGet.METHOD_NAME, endpoint);
@@ -723,8 +731,7 @@ final class IndicesRequestConverters {
}
static Request getIndexTemplates(GetComposableIndexTemplateRequest getIndexTemplatesRequest) {
- final String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_index_template")
+ final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_index_template")
.addPathPart(getIndexTemplatesRequest.name())
.build();
final Request request = new Request(HttpGet.METHOD_NAME, endpoint);
@@ -736,8 +743,7 @@ final class IndicesRequestConverters {
}
static Request templatesExist(IndexTemplatesExistRequest indexTemplatesExistRequest) {
- final String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_template")
+ final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_template")
.addCommaSeparatedPathParts(indexTemplatesExistRequest.names())
.build();
final Request request = new Request(HttpHead.METHOD_NAME, endpoint);
@@ -749,8 +755,7 @@ final class IndicesRequestConverters {
}
static Request templatesExist(ComposableIndexTemplateExistRequest indexTemplatesExistRequest) {
- final String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_index_template")
+ final String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_index_template")
.addPathPart(indexTemplatesExistRequest.name())
.build();
final Request request = new Request(HttpHead.METHOD_NAME, endpoint);
@@ -794,10 +799,10 @@ final class IndicesRequestConverters {
}
static Request deleteAlias(DeleteAliasRequest deleteAliasRequest) {
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPart(deleteAliasRequest.getIndex())
+ String endpoint = new RequestConverters.EndpointBuilder().addPathPart(deleteAliasRequest.getIndex())
.addPathPartAsIs("_alias")
- .addPathPart(deleteAliasRequest.getAlias()).build();
+ .addPathPart(deleteAliasRequest.getAlias())
+ .build();
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params();
parameters.withTimeout(deleteAliasRequest.timeout());
diff --git a/client/rest-high-level/src/main/java/org/opensearch/client/IngestClient.java b/client/rest-high-level/src/main/java/org/opensearch/client/IngestClient.java
index ca79325ba37..93dd3513a46 100644
--- a/client/rest-high-level/src/main/java/org/opensearch/client/IngestClient.java
+++ b/client/rest-high-level/src/main/java/org/opensearch/client/IngestClient.java
@@ -32,8 +32,6 @@
package org.opensearch.client;
-import org.opensearch.client.Cancellable;
-import org.opensearch.client.RequestOptions;
import org.opensearch.action.ActionListener;
import org.opensearch.action.ingest.DeletePipelineRequest;
import org.opensearch.action.ingest.GetPipelineRequest;
@@ -69,8 +67,13 @@ public final class IngestClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public AcknowledgedResponse putPipeline(PutPipelineRequest request, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::putPipeline, options,
- AcknowledgedResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ request,
+ IngestRequestConverters::putPipeline,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -82,8 +85,14 @@ public final class IngestClient {
* @return cancellable that may be used to cancel the request
*/
public Cancellable putPipelineAsync(PutPipelineRequest request, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity( request, IngestRequestConverters::putPipeline, options,
- AcknowledgedResponse::fromXContent, listener, emptySet());
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ request,
+ IngestRequestConverters::putPipeline,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -95,8 +104,13 @@ public final class IngestClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public GetPipelineResponse getPipeline(GetPipelineRequest request, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::getPipeline, options,
- GetPipelineResponse::fromXContent, Collections.singleton(404));
+ return restHighLevelClient.performRequestAndParseEntity(
+ request,
+ IngestRequestConverters::getPipeline,
+ options,
+ GetPipelineResponse::fromXContent,
+ Collections.singleton(404)
+ );
}
/**
@@ -108,8 +122,14 @@ public final class IngestClient {
* @return cancellable that may be used to cancel the request
*/
public Cancellable getPipelineAsync(GetPipelineRequest request, RequestOptions options, ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity( request, IngestRequestConverters::getPipeline, options,
- GetPipelineResponse::fromXContent, listener, Collections.singleton(404));
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ request,
+ IngestRequestConverters::getPipeline,
+ options,
+ GetPipelineResponse::fromXContent,
+ listener,
+ Collections.singleton(404)
+ );
}
/**
@@ -121,8 +141,13 @@ public final class IngestClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public AcknowledgedResponse deletePipeline(DeletePipelineRequest request, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::deletePipeline, options,
- AcknowledgedResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ request,
+ IngestRequestConverters::deletePipeline,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -133,11 +158,19 @@ public final class IngestClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable deletePipelineAsync(DeletePipelineRequest request, RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity( request,
- IngestRequestConverters::deletePipeline, options,
- AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable deletePipelineAsync(
+ DeletePipelineRequest request,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ request,
+ IngestRequestConverters::deletePipeline,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -150,8 +183,13 @@ public final class IngestClient {
* @throws IOException in case there is a problem sending the request or parsing back the response
*/
public SimulatePipelineResponse simulate(SimulatePipelineRequest request, RequestOptions options) throws IOException {
- return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::simulatePipeline, options,
- SimulatePipelineResponse::fromXContent, emptySet());
+ return restHighLevelClient.performRequestAndParseEntity(
+ request,
+ IngestRequestConverters::simulatePipeline,
+ options,
+ SimulatePipelineResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -163,10 +201,18 @@ public final class IngestClient {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable simulateAsync(SimulatePipelineRequest request,
- RequestOptions options,
- ActionListener listener) {
- return restHighLevelClient.performRequestAsyncAndParseEntity( request, IngestRequestConverters::simulatePipeline, options,
- SimulatePipelineResponse::fromXContent, listener, emptySet());
+ public Cancellable simulateAsync(
+ SimulatePipelineRequest request,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return restHighLevelClient.performRequestAsyncAndParseEntity(
+ request,
+ IngestRequestConverters::simulatePipeline,
+ options,
+ SimulatePipelineResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
}
diff --git a/client/rest-high-level/src/main/java/org/opensearch/client/IngestRequestConverters.java b/client/rest-high-level/src/main/java/org/opensearch/client/IngestRequestConverters.java
index fd2137fa1ad..e2ede61f38e 100644
--- a/client/rest-high-level/src/main/java/org/opensearch/client/IngestRequestConverters.java
+++ b/client/rest-high-level/src/main/java/org/opensearch/client/IngestRequestConverters.java
@@ -40,7 +40,6 @@ import org.opensearch.action.ingest.DeletePipelineRequest;
import org.opensearch.action.ingest.GetPipelineRequest;
import org.opensearch.action.ingest.PutPipelineRequest;
import org.opensearch.action.ingest.SimulatePipelineRequest;
-import org.opensearch.client.Request;
import java.io.IOException;
@@ -49,8 +48,7 @@ final class IngestRequestConverters {
private IngestRequestConverters() {}
static Request getPipeline(GetPipelineRequest getPipelineRequest) {
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_ingest/pipeline")
+ String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_ingest/pipeline")
.addCommaSeparatedPathParts(getPipelineRequest.getIds())
.build();
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
@@ -62,8 +60,7 @@ final class IngestRequestConverters {
}
static Request putPipeline(PutPipelineRequest putPipelineRequest) throws IOException {
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_ingest/pipeline")
+ String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_ingest/pipeline")
.addPathPart(putPipelineRequest.getId())
.build();
Request request = new Request(HttpPut.METHOD_NAME, endpoint);
@@ -77,8 +74,7 @@ final class IngestRequestConverters {
}
static Request deletePipeline(DeletePipelineRequest deletePipelineRequest) {
- String endpoint = new RequestConverters.EndpointBuilder()
- .addPathPartAsIs("_ingest/pipeline")
+ String endpoint = new RequestConverters.EndpointBuilder().addPathPartAsIs("_ingest/pipeline")
.addPathPart(deletePipelineRequest.getId())
.build();
Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
diff --git a/client/rest-high-level/src/main/java/org/opensearch/client/NodesResponseHeader.java b/client/rest-high-level/src/main/java/org/opensearch/client/NodesResponseHeader.java
index a6a49357632..7b094677986 100644
--- a/client/rest-high-level/src/main/java/org/opensearch/client/NodesResponseHeader.java
+++ b/client/rest-high-level/src/main/java/org/opensearch/client/NodesResponseHeader.java
@@ -58,23 +58,28 @@ public final class NodesResponseHeader {
public static final ParseField FAILURES = new ParseField("failures");
@SuppressWarnings("unchecked")
- public static final ConstructingObjectParser PARSER =
- new ConstructingObjectParser<>("nodes_response_header", true,
- (a) -> {
- int i = 0;
- int total = (Integer) a[i++];
- int successful = (Integer) a[i++];
- int failed = (Integer) a[i++];
- List failures = (List) a[i++];
- return new NodesResponseHeader(total, successful, failed, failures);
- });
+ public static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>(
+ "nodes_response_header",
+ true,
+ (a) -> {
+ int i = 0;
+ int total = (Integer) a[i++];
+ int successful = (Integer) a[i++];
+ int failed = (Integer) a[i++];
+ List failures = (List) a[i++];
+ return new NodesResponseHeader(total, successful, failed, failures);
+ }
+ );
static {
PARSER.declareInt(ConstructingObjectParser.constructorArg(), TOTAL);
PARSER.declareInt(ConstructingObjectParser.constructorArg(), SUCCESSFUL);
PARSER.declareInt(ConstructingObjectParser.constructorArg(), FAILED);
- PARSER.declareObjectArray(ConstructingObjectParser.optionalConstructorArg(),
- (p, c) -> OpenSearchException.fromXContent(p), FAILURES);
+ PARSER.declareObjectArray(
+ ConstructingObjectParser.optionalConstructorArg(),
+ (p, c) -> OpenSearchException.fromXContent(p),
+ FAILURES
+ );
}
private final int total;
@@ -135,10 +140,7 @@ public final class NodesResponseHeader {
return false;
}
NodesResponseHeader that = (NodesResponseHeader) o;
- return total == that.total &&
- successful == that.successful &&
- failed == that.failed &&
- Objects.equals(failures, that.failures);
+ return total == that.total && successful == that.successful && failed == that.failed && Objects.equals(failures, that.failures);
}
@Override
diff --git a/client/rest-high-level/src/main/java/org/opensearch/client/RequestConverters.java b/client/rest-high-level/src/main/java/org/opensearch/client/RequestConverters.java
index 27a36f8a477..acafcf96c2a 100644
--- a/client/rest-high-level/src/main/java/org/opensearch/client/RequestConverters.java
+++ b/client/rest-high-level/src/main/java/org/opensearch/client/RequestConverters.java
@@ -243,14 +243,19 @@ final class RequestConverters {
BytesReference indexSource = indexRequest.source();
XContentType indexXContentType = indexRequest.getContentType();
- try (XContentParser parser = XContentHelper.createParser(
+ try (
+ XContentParser parser = XContentHelper.createParser(
/*
* EMPTY and THROW are fine here because we just call
* copyCurrentStructure which doesn't touch the
* registry or deprecation.
*/
- NamedXContentRegistry.EMPTY, DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
- indexSource, indexXContentType)) {
+ NamedXContentRegistry.EMPTY,
+ DeprecationHandler.THROW_UNSUPPORTED_OPERATION,
+ indexSource,
+ indexXContentType
+ )
+ ) {
try (XContentBuilder builder = XContentBuilder.builder(bulkContentType.xContent())) {
builder.copyCurrentStructure(parser);
source = BytesReference.bytes(builder).toBytesRef();
@@ -398,8 +403,14 @@ final class RequestConverters {
if (updateRequest.upsertRequest() != null) {
XContentType upsertContentType = updateRequest.upsertRequest().getContentType();
if ((xContentType != null) && (xContentType != upsertContentType)) {
- throw new IllegalStateException("Update request cannot have different content types for doc [" + xContentType + "]" +
- " and upsert [" + upsertContentType + "] documents");
+ throw new IllegalStateException(
+ "Update request cannot have different content types for doc ["
+ + xContentType
+ + "]"
+ + " and upsert ["
+ + upsertContentType
+ + "] documents"
+ );
} else {
xContentType = upsertContentType;
}
@@ -523,10 +534,10 @@ final class RequestConverters {
params.withRouting(countRequest.routing());
params.withPreference(countRequest.preference());
params.withIndicesOptions(countRequest.indicesOptions());
- if (countRequest.terminateAfter() != 0){
+ if (countRequest.terminateAfter() != 0) {
params.withTerminateAfter(countRequest.terminateAfter());
}
- if (countRequest.minScore() != null){
+ if (countRequest.minScore() != null) {
params.putParam("min_score", String.valueOf(countRequest.minScore()));
}
request.addParameters(params.asMap());
@@ -551,7 +562,7 @@ final class RequestConverters {
}
static Request fieldCaps(FieldCapabilitiesRequest fieldCapabilitiesRequest) throws IOException {
- String methodName = fieldCapabilitiesRequest.indexFilter() != null ? HttpPost.METHOD_NAME : HttpGet.METHOD_NAME;
+ String methodName = fieldCapabilitiesRequest.indexFilter() != null ? HttpPost.METHOD_NAME : HttpGet.METHOD_NAME;
Request request = new Request(methodName, endpoint(fieldCapabilitiesRequest.indices(), "_field_caps"));
Params params = new Params();
@@ -602,8 +613,7 @@ final class RequestConverters {
private static Request prepareReindexRequest(ReindexRequest reindexRequest, boolean waitForCompletion) throws IOException {
String endpoint = new EndpointBuilder().addPathPart("_reindex").build();
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
- Params params = new Params()
- .withWaitForCompletion(waitForCompletion)
+ Params params = new Params().withWaitForCompletion(waitForCompletion)
.withRefresh(reindexRequest.isRefresh())
.withTimeout(reindexRequest.getTimeout())
.withWaitForActiveShards(reindexRequest.getWaitForActiveShards())
@@ -618,13 +628,11 @@ final class RequestConverters {
return request;
}
- private static Request prepareDeleteByQueryRequest(DeleteByQueryRequest deleteByQueryRequest,
- boolean waitForCompletion) throws IOException {
- String endpoint =
- endpoint(deleteByQueryRequest.indices(), deleteByQueryRequest.getDocTypes(), "_delete_by_query");
+ private static Request prepareDeleteByQueryRequest(DeleteByQueryRequest deleteByQueryRequest, boolean waitForCompletion)
+ throws IOException {
+ String endpoint = endpoint(deleteByQueryRequest.indices(), deleteByQueryRequest.getDocTypes(), "_delete_by_query");
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
- Params params = new Params()
- .withRouting(deleteByQueryRequest.getRouting())
+ Params params = new Params().withRouting(deleteByQueryRequest.getRouting())
.withRefresh(deleteByQueryRequest.isRefresh())
.withTimeout(deleteByQueryRequest.getTimeout())
.withWaitForActiveShards(deleteByQueryRequest.getWaitForActiveShards())
@@ -649,13 +657,10 @@ final class RequestConverters {
return request;
}
- static Request prepareUpdateByQueryRequest(UpdateByQueryRequest updateByQueryRequest,
- boolean waitForCompletion) throws IOException {
- String endpoint =
- endpoint(updateByQueryRequest.indices(), updateByQueryRequest.getDocTypes(), "_update_by_query");
+ static Request prepareUpdateByQueryRequest(UpdateByQueryRequest updateByQueryRequest, boolean waitForCompletion) throws IOException {
+ String endpoint = endpoint(updateByQueryRequest.indices(), updateByQueryRequest.getDocTypes(), "_update_by_query");
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
- Params params = new Params()
- .withRouting(updateByQueryRequest.getRouting())
+ Params params = new Params().withRouting(updateByQueryRequest.getRouting())
.withPipeline(updateByQueryRequest.getPipeline())
.withRefresh(updateByQueryRequest.isRefresh())
.withTimeout(updateByQueryRequest.getTimeout())
@@ -694,11 +699,12 @@ final class RequestConverters {
}
private static Request rethrottle(RethrottleRequest rethrottleRequest, String firstPathPart) {
- String endpoint = new EndpointBuilder().addPathPart(firstPathPart).addPathPart(rethrottleRequest.getTaskId().toString())
- .addPathPart("_rethrottle").build();
+ String endpoint = new EndpointBuilder().addPathPart(firstPathPart)
+ .addPathPart(rethrottleRequest.getTaskId().toString())
+ .addPathPart("_rethrottle")
+ .build();
Request request = new Request(HttpPost.METHOD_NAME, endpoint);
- Params params = new Params()
- .withRequestsPerSecond(rethrottleRequest.getRequestsPerSecond());
+ Params params = new Params().withRequestsPerSecond(rethrottleRequest.getRequestsPerSecond());
// we set "group_by" to "none" because this is the response format we can parse back
params.putParam("group_by", "none");
request.addParameters(params.asMap());
@@ -807,13 +813,17 @@ final class RequestConverters {
}
static String endpoint(String[] indices, String[] types, String endpoint) {
- return new EndpointBuilder().addCommaSeparatedPathParts(indices).addCommaSeparatedPathParts(types)
- .addPathPartAsIs(endpoint).build();
+ return new EndpointBuilder().addCommaSeparatedPathParts(indices)
+ .addCommaSeparatedPathParts(types)
+ .addPathPartAsIs(endpoint)
+ .build();
}
static String endpoint(String[] indices, String endpoint, String[] suffixes) {
- return new EndpointBuilder().addCommaSeparatedPathParts(indices).addPathPartAsIs(endpoint)
- .addCommaSeparatedPathParts(suffixes).build();
+ return new EndpointBuilder().addCommaSeparatedPathParts(indices)
+ .addPathPartAsIs(endpoint)
+ .addCommaSeparatedPathParts(suffixes)
+ .build();
}
static String endpoint(String[] indices, String endpoint, String type) {
@@ -836,14 +846,13 @@ final class RequestConverters {
* a {@link Request} and adds the parameters to it directly.
*/
static class Params {
- private final Map parameters = new HashMap<>();
+ private final Map parameters = new HashMap<>();
- Params() {
- }
+ Params() {}
Params putParam(String name, String value) {
if (Strings.hasLength(value)) {
- parameters.put(name,value);
+ parameters.put(name, value);
}
return this;
}
@@ -855,7 +864,7 @@ final class RequestConverters {
return this;
}
- Map asMap(){
+ Map asMap() {
return parameters;
}
@@ -981,7 +990,7 @@ final class RequestConverters {
return this;
}
- Params withTerminateAfter(int terminateAfter){
+ Params withTerminateAfter(int terminateAfter) {
return putParam("terminate_after", String.valueOf(terminateAfter));
}
@@ -1097,7 +1106,7 @@ final class RequestConverters {
}
Params withNodes(String[] nodes) {
- return withNodes(Arrays.asList(nodes));
+ return withNodes(Arrays.asList(nodes));
}
Params withNodes(List nodes) {
@@ -1192,15 +1201,23 @@ final class RequestConverters {
static XContentType enforceSameContentType(IndexRequest indexRequest, @Nullable XContentType xContentType) {
XContentType requestContentType = indexRequest.getContentType();
if (requestContentType != XContentType.JSON && requestContentType != XContentType.SMILE) {
- throw new IllegalArgumentException("Unsupported content-type found for request with content-type [" + requestContentType
- + "], only JSON and SMILE are supported");
+ throw new IllegalArgumentException(
+ "Unsupported content-type found for request with content-type ["
+ + requestContentType
+ + "], only JSON and SMILE are supported"
+ );
}
if (xContentType == null) {
return requestContentType;
}
if (requestContentType != xContentType) {
- throw new IllegalArgumentException("Mismatching content-type found for request with content-type [" + requestContentType
- + "], previous requests have content-type [" + xContentType + "]");
+ throw new IllegalArgumentException(
+ "Mismatching content-type found for request with content-type ["
+ + requestContentType
+ + "], previous requests have content-type ["
+ + xContentType
+ + "]"
+ );
}
return xContentType;
}
@@ -1231,7 +1248,7 @@ final class RequestConverters {
return this;
}
- EndpointBuilder addPathPartAsIs(String ... parts) {
+ EndpointBuilder addPathPartAsIs(String... parts) {
for (String part : parts) {
if (Strings.hasLength(part)) {
joiner.add(part);
@@ -1246,13 +1263,13 @@ final class RequestConverters {
private static String encodePart(String pathPart) {
try {
- //encode each part (e.g. index, type and id) separately before merging them into the path
- //we prepend "/" to the path part to make this path absolute, otherwise there can be issues with
- //paths that start with `-` or contain `:`
- //the authority must be an empty string and not null, else paths that being with slashes could have them
- //misinterpreted as part of the authority.
+ // encode each part (e.g. index, type and id) separately before merging them into the path
+ // we prepend "/" to the path part to make this path absolute, otherwise there can be issues with
+ // paths that start with `-` or contain `:`
+ // the authority must be an empty string and not null, else paths that being with slashes could have them
+ // misinterpreted as part of the authority.
URI uri = new URI(null, "", "/" + pathPart, null, null);
- //manually encode any slash that each part may contain
+ // manually encode any slash that each part may contain
return uri.getRawPath().substring(1).replaceAll("/", "%2F");
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Path part [" + pathPart + "] couldn't be encoded", e);
@@ -1260,4 +1277,3 @@ final class RequestConverters {
}
}
}
-
diff --git a/client/rest-high-level/src/main/java/org/opensearch/client/RestHighLevelClient.java b/client/rest-high-level/src/main/java/org/opensearch/client/RestHighLevelClient.java
index c08df87f0e9..3eebb361fd9 100644
--- a/client/rest-high-level/src/main/java/org/opensearch/client/RestHighLevelClient.java
+++ b/client/rest-high-level/src/main/java/org/opensearch/client/RestHighLevelClient.java
@@ -33,14 +33,6 @@
package org.opensearch.client;
import org.apache.http.HttpEntity;
-import org.opensearch.client.Cancellable;
-import org.opensearch.client.Request;
-import org.opensearch.client.RequestOptions;
-import org.opensearch.client.Response;
-import org.opensearch.client.ResponseException;
-import org.opensearch.client.ResponseListener;
-import org.opensearch.client.RestClient;
-import org.opensearch.client.RestClientBuilder;
import org.opensearch.OpenSearchException;
import org.opensearch.OpenSearchStatusException;
import org.opensearch.action.ActionListener;
@@ -299,13 +291,18 @@ public class RestHighLevelClient implements Closeable {
* The consumer argument allows to control what needs to be done when the {@link #close()} method is called.
* Also subclasses can provide parsers for custom response sections added to OpenSearch through plugins.
*/
- protected RestHighLevelClient(RestClient restClient, CheckedConsumer doClose,
- List namedXContentEntries) {
+ protected RestHighLevelClient(
+ RestClient restClient,
+ CheckedConsumer doClose,
+ List namedXContentEntries
+ ) {
this.client = Objects.requireNonNull(restClient, "restClient must not be null");
this.doClose = Objects.requireNonNull(doClose, "doClose consumer must not be null");
this.registry = new NamedXContentRegistry(
- Stream.of(getDefaultNamedXContents().stream(), getProvidedNamedXContents().stream(), namedXContentEntries.stream())
- .flatMap(Function.identity()).collect(toList()));
+ Stream.of(getDefaultNamedXContents().stream(), getProvidedNamedXContents().stream(), namedXContentEntries.stream())
+ .flatMap(Function.identity())
+ .collect(toList())
+ );
}
/**
@@ -374,8 +371,14 @@ public class RestHighLevelClient implements Closeable {
* @return cancellable that may be used to cancel the request
*/
public final Cancellable bulkAsync(BulkRequest bulkRequest, RequestOptions options, ActionListener listener) {
- return performRequestAsyncAndParseEntity(bulkRequest, RequestConverters::bulk, options,
- BulkResponse::fromXContent, listener, emptySet());
+ return performRequestAsyncAndParseEntity(
+ bulkRequest,
+ RequestConverters::bulk,
+ options,
+ BulkResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -386,7 +389,11 @@ public class RestHighLevelClient implements Closeable {
*/
public final BulkByScrollResponse reindex(ReindexRequest reindexRequest, RequestOptions options) throws IOException {
return performRequestAndParseEntity(
- reindexRequest, RequestConverters::reindex, options, BulkByScrollResponse::fromXContent, singleton(409)
+ reindexRequest,
+ RequestConverters::reindex,
+ options,
+ BulkByScrollResponse::fromXContent,
+ singleton(409)
);
}
@@ -398,7 +405,11 @@ public class RestHighLevelClient implements Closeable {
*/
public final TaskSubmissionResponse submitReindexTask(ReindexRequest reindexRequest, RequestOptions options) throws IOException {
return performRequestAndParseEntity(
- reindexRequest, RequestConverters::submitReindex, options, TaskSubmissionResponse::fromXContent, emptySet()
+ reindexRequest,
+ RequestConverters::submitReindex,
+ options,
+ TaskSubmissionResponse::fromXContent,
+ emptySet()
);
}
@@ -409,10 +420,18 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable reindexAsync(ReindexRequest reindexRequest, RequestOptions options,
- ActionListener listener) {
+ public final Cancellable reindexAsync(
+ ReindexRequest reindexRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
return performRequestAsyncAndParseEntity(
- reindexRequest, RequestConverters::reindex, options, BulkByScrollResponse::fromXContent, listener, singleton(409)
+ reindexRequest,
+ RequestConverters::reindex,
+ options,
+ BulkByScrollResponse::fromXContent,
+ listener,
+ singleton(409)
);
}
@@ -425,7 +444,11 @@ public class RestHighLevelClient implements Closeable {
*/
public final BulkByScrollResponse updateByQuery(UpdateByQueryRequest updateByQueryRequest, RequestOptions options) throws IOException {
return performRequestAndParseEntity(
- updateByQueryRequest, RequestConverters::updateByQuery, options, BulkByScrollResponse::fromXContent, singleton(409)
+ updateByQueryRequest,
+ RequestConverters::updateByQuery,
+ options,
+ BulkByScrollResponse::fromXContent,
+ singleton(409)
);
}
@@ -436,10 +459,14 @@ public class RestHighLevelClient implements Closeable {
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return the submission response
*/
- public final TaskSubmissionResponse submitUpdateByQueryTask(UpdateByQueryRequest updateByQueryRequest,
- RequestOptions options) throws IOException {
+ public final TaskSubmissionResponse submitUpdateByQueryTask(UpdateByQueryRequest updateByQueryRequest, RequestOptions options)
+ throws IOException {
return performRequestAndParseEntity(
- updateByQueryRequest, RequestConverters::submitUpdateByQuery, options, TaskSubmissionResponse::fromXContent, emptySet()
+ updateByQueryRequest,
+ RequestConverters::submitUpdateByQuery,
+ options,
+ TaskSubmissionResponse::fromXContent,
+ emptySet()
);
}
@@ -451,10 +478,18 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable updateByQueryAsync(UpdateByQueryRequest updateByQueryRequest, RequestOptions options,
- ActionListener listener) {
+ public final Cancellable updateByQueryAsync(
+ UpdateByQueryRequest updateByQueryRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
return performRequestAsyncAndParseEntity(
- updateByQueryRequest, RequestConverters::updateByQuery, options, BulkByScrollResponse::fromXContent, listener, singleton(409)
+ updateByQueryRequest,
+ RequestConverters::updateByQuery,
+ options,
+ BulkByScrollResponse::fromXContent,
+ listener,
+ singleton(409)
);
}
@@ -467,7 +502,11 @@ public class RestHighLevelClient implements Closeable {
*/
public final BulkByScrollResponse deleteByQuery(DeleteByQueryRequest deleteByQueryRequest, RequestOptions options) throws IOException {
return performRequestAndParseEntity(
- deleteByQueryRequest, RequestConverters::deleteByQuery, options, BulkByScrollResponse::fromXContent, singleton(409)
+ deleteByQueryRequest,
+ RequestConverters::deleteByQuery,
+ options,
+ BulkByScrollResponse::fromXContent,
+ singleton(409)
);
}
@@ -478,10 +517,14 @@ public class RestHighLevelClient implements Closeable {
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return the submission response
*/
- public final TaskSubmissionResponse submitDeleteByQueryTask(DeleteByQueryRequest deleteByQueryRequest,
- RequestOptions options) throws IOException {
+ public final TaskSubmissionResponse submitDeleteByQueryTask(DeleteByQueryRequest deleteByQueryRequest, RequestOptions options)
+ throws IOException {
return performRequestAndParseEntity(
- deleteByQueryRequest, RequestConverters::submitDeleteByQuery, options, TaskSubmissionResponse::fromXContent, emptySet()
+ deleteByQueryRequest,
+ RequestConverters::submitDeleteByQuery,
+ options,
+ TaskSubmissionResponse::fromXContent,
+ emptySet()
);
}
@@ -493,10 +536,18 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable deleteByQueryAsync(DeleteByQueryRequest deleteByQueryRequest, RequestOptions options,
- ActionListener listener) {
+ public final Cancellable deleteByQueryAsync(
+ DeleteByQueryRequest deleteByQueryRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
return performRequestAsyncAndParseEntity(
- deleteByQueryRequest, RequestConverters::deleteByQuery, options, BulkByScrollResponse::fromXContent, listener, singleton(409)
+ deleteByQueryRequest,
+ RequestConverters::deleteByQuery,
+ options,
+ BulkByScrollResponse::fromXContent,
+ listener,
+ singleton(409)
);
}
@@ -508,8 +559,13 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public final ListTasksResponse deleteByQueryRethrottle(RethrottleRequest rethrottleRequest, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(rethrottleRequest, RequestConverters::rethrottleDeleteByQuery, options,
- ListTasksResponse::fromXContent, emptySet());
+ return performRequestAndParseEntity(
+ rethrottleRequest,
+ RequestConverters::rethrottleDeleteByQuery,
+ options,
+ ListTasksResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -520,10 +576,19 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable deleteByQueryRethrottleAsync(RethrottleRequest rethrottleRequest, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(rethrottleRequest, RequestConverters::rethrottleDeleteByQuery, options,
- ListTasksResponse::fromXContent, listener, emptySet());
+ public final Cancellable deleteByQueryRethrottleAsync(
+ RethrottleRequest rethrottleRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ rethrottleRequest,
+ RequestConverters::rethrottleDeleteByQuery,
+ options,
+ ListTasksResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -534,8 +599,13 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public final ListTasksResponse updateByQueryRethrottle(RethrottleRequest rethrottleRequest, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(rethrottleRequest, RequestConverters::rethrottleUpdateByQuery, options,
- ListTasksResponse::fromXContent, emptySet());
+ return performRequestAndParseEntity(
+ rethrottleRequest,
+ RequestConverters::rethrottleUpdateByQuery,
+ options,
+ ListTasksResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -546,10 +616,19 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable updateByQueryRethrottleAsync(RethrottleRequest rethrottleRequest, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(rethrottleRequest, RequestConverters::rethrottleUpdateByQuery, options,
- ListTasksResponse::fromXContent, listener, emptySet());
+ public final Cancellable updateByQueryRethrottleAsync(
+ RethrottleRequest rethrottleRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ rethrottleRequest,
+ RequestConverters::rethrottleUpdateByQuery,
+ options,
+ ListTasksResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -560,8 +639,13 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public final ListTasksResponse reindexRethrottle(RethrottleRequest rethrottleRequest, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(rethrottleRequest, RequestConverters::rethrottleReindex, options,
- ListTasksResponse::fromXContent, emptySet());
+ return performRequestAndParseEntity(
+ rethrottleRequest,
+ RequestConverters::rethrottleReindex,
+ options,
+ ListTasksResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -572,10 +656,19 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable reindexRethrottleAsync(RethrottleRequest rethrottleRequest, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(rethrottleRequest,
- RequestConverters::rethrottleReindex, options, ListTasksResponse::fromXContent, listener, emptySet());
+ public final Cancellable reindexRethrottleAsync(
+ RethrottleRequest rethrottleRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ rethrottleRequest,
+ RequestConverters::rethrottleReindex,
+ options,
+ ListTasksResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -584,8 +677,13 @@ public class RestHighLevelClient implements Closeable {
* @return true
if the ping succeeded, false otherwise
*/
public final boolean ping(RequestOptions options) throws IOException {
- return performRequest(new MainRequest(), (request) -> RequestConverters.ping(), options, RestHighLevelClient::convertExistsResponse,
- emptySet());
+ return performRequest(
+ new MainRequest(),
+ (request) -> RequestConverters.ping(),
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ emptySet()
+ );
}
/**
@@ -594,8 +692,13 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public final MainResponse info(RequestOptions options) throws IOException {
- return performRequestAndParseEntity(new MainRequest(), (request) -> RequestConverters.info(), options,
- MainResponse::fromXContent, emptySet());
+ return performRequestAndParseEntity(
+ new MainRequest(),
+ (request) -> RequestConverters.info(),
+ options,
+ MainResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -618,8 +721,14 @@ public class RestHighLevelClient implements Closeable {
* @return cancellable that may be used to cancel the request
*/
public final Cancellable getAsync(GetRequest getRequest, RequestOptions options, ActionListener listener) {
- return performRequestAsyncAndParseEntity(getRequest, RequestConverters::get, options, GetResponse::fromXContent, listener,
- singleton(404));
+ return performRequestAsyncAndParseEntity(
+ getRequest,
+ RequestConverters::get,
+ options,
+ GetResponse::fromXContent,
+ listener,
+ singleton(404)
+ );
}
/**
@@ -635,7 +744,6 @@ public class RestHighLevelClient implements Closeable {
return mget(multiGetRequest, options);
}
-
/**
* Retrieves multiple documents by id using the Multi Get API.
*
@@ -644,8 +752,13 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public final MultiGetResponse mget(MultiGetRequest multiGetRequest, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(multiGetRequest, RequestConverters::multiGet, options, MultiGetResponse::fromXContent,
- singleton(404));
+ return performRequestAndParseEntity(
+ multiGetRequest,
+ RequestConverters::multiGet,
+ options,
+ MultiGetResponse::fromXContent,
+ singleton(404)
+ );
}
/**
@@ -658,8 +771,11 @@ public class RestHighLevelClient implements Closeable {
* @return cancellable that may be used to cancel the request
*/
@Deprecated
- public final Cancellable multiGetAsync(MultiGetRequest multiGetRequest, RequestOptions options,
- ActionListener listener) {
+ public final Cancellable multiGetAsync(
+ MultiGetRequest multiGetRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
return mgetAsync(multiGetRequest, options, listener);
}
@@ -671,10 +787,15 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable mgetAsync(MultiGetRequest multiGetRequest, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(multiGetRequest, RequestConverters::multiGet, options,
- MultiGetResponse::fromXContent, listener, singleton(404));
+ public final Cancellable mgetAsync(MultiGetRequest multiGetRequest, RequestOptions options, ActionListener listener) {
+ return performRequestAsyncAndParseEntity(
+ multiGetRequest,
+ RequestConverters::multiGet,
+ options,
+ MultiGetResponse::fromXContent,
+ listener,
+ singleton(404)
+ );
}
/**
@@ -697,8 +818,14 @@ public class RestHighLevelClient implements Closeable {
* @return cancellable that may be used to cancel the request
*/
public final Cancellable existsAsync(GetRequest getRequest, RequestOptions options, ActionListener listener) {
- return performRequestAsync(getRequest, RequestConverters::exists, options, RestHighLevelClient::convertExistsResponse, listener,
- emptySet());
+ return performRequestAsync(
+ getRequest,
+ RequestConverters::exists,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ listener,
+ emptySet()
+ );
}
/**
@@ -712,8 +839,13 @@ public class RestHighLevelClient implements Closeable {
@Deprecated
public boolean existsSource(GetRequest getRequest, RequestOptions options) throws IOException {
GetSourceRequest getSourceRequest = GetSourceRequest.from(getRequest);
- return performRequest(getSourceRequest, RequestConverters::sourceExists, options,
- RestHighLevelClient::convertExistsResponse, emptySet());
+ return performRequest(
+ getSourceRequest,
+ RequestConverters::sourceExists,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ emptySet()
+ );
}
/**
@@ -728,8 +860,14 @@ public class RestHighLevelClient implements Closeable {
@Deprecated
public final Cancellable existsSourceAsync(GetRequest getRequest, RequestOptions options, ActionListener listener) {
GetSourceRequest getSourceRequest = GetSourceRequest.from(getRequest);
- return performRequestAsync(getSourceRequest, RequestConverters::sourceExists, options,
- RestHighLevelClient::convertExistsResponse, listener, emptySet());
+ return performRequestAsync(
+ getSourceRequest,
+ RequestConverters::sourceExists,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ listener,
+ emptySet()
+ );
}
/**
@@ -740,8 +878,13 @@ public class RestHighLevelClient implements Closeable {
* @return true
if the document and _source field exists, false
otherwise
*/
public boolean existsSource(GetSourceRequest getSourceRequest, RequestOptions options) throws IOException {
- return performRequest(getSourceRequest, RequestConverters::sourceExists, options,
- RestHighLevelClient::convertExistsResponse, emptySet());
+ return performRequest(
+ getSourceRequest,
+ RequestConverters::sourceExists,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ emptySet()
+ );
}
/**
@@ -752,10 +895,19 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable existsSourceAsync(GetSourceRequest getSourceRequest, RequestOptions options,
- ActionListener listener) {
- return performRequestAsync(getSourceRequest, RequestConverters::sourceExists, options,
- RestHighLevelClient::convertExistsResponse, listener, emptySet());
+ public final Cancellable existsSourceAsync(
+ GetSourceRequest getSourceRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsync(
+ getSourceRequest,
+ RequestConverters::sourceExists,
+ options,
+ RestHighLevelClient::convertExistsResponse,
+ listener,
+ emptySet()
+ );
}
/**
@@ -766,8 +918,13 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public GetSourceResponse getSource(GetSourceRequest getSourceRequest, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(getSourceRequest, RequestConverters::getSource, options,
- GetSourceResponse::fromXContent, emptySet());
+ return performRequestAndParseEntity(
+ getSourceRequest,
+ RequestConverters::getSource,
+ options,
+ GetSourceResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -778,10 +935,19 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable getSourceAsync(GetSourceRequest getSourceRequest, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(getSourceRequest, RequestConverters::getSource, options,
- GetSourceResponse::fromXContent, listener, emptySet());
+ public final Cancellable getSourceAsync(
+ GetSourceRequest getSourceRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ getSourceRequest,
+ RequestConverters::getSource,
+ options,
+ GetSourceResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -792,8 +958,7 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public final IndexResponse index(IndexRequest indexRequest, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(indexRequest, RequestConverters::index, options,
- IndexResponse::fromXContent, emptySet());
+ return performRequestAndParseEntity(indexRequest, RequestConverters::index, options, IndexResponse::fromXContent, emptySet());
}
/**
@@ -805,8 +970,14 @@ public class RestHighLevelClient implements Closeable {
* @return cancellable that may be used to cancel the request
*/
public final Cancellable indexAsync(IndexRequest indexRequest, RequestOptions options, ActionListener listener) {
- return performRequestAsyncAndParseEntity(indexRequest, RequestConverters::index, options, IndexResponse::fromXContent, listener,
- emptySet());
+ return performRequestAsyncAndParseEntity(
+ indexRequest,
+ RequestConverters::index,
+ options,
+ IndexResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -817,8 +988,7 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public final CountResponse count(CountRequest countRequest, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(countRequest, RequestConverters::count, options, CountResponse::fromXContent,
- emptySet());
+ return performRequestAndParseEntity(countRequest, RequestConverters::count, options, CountResponse::fromXContent, emptySet());
}
/**
@@ -830,8 +1000,14 @@ public class RestHighLevelClient implements Closeable {
* @return cancellable that may be used to cancel the request
*/
public final Cancellable countAsync(CountRequest countRequest, RequestOptions options, ActionListener listener) {
- return performRequestAsyncAndParseEntity(countRequest, RequestConverters::count, options,CountResponse::fromXContent,
- listener, emptySet());
+ return performRequestAsyncAndParseEntity(
+ countRequest,
+ RequestConverters::count,
+ options,
+ CountResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -854,8 +1030,14 @@ public class RestHighLevelClient implements Closeable {
* @return cancellable that may be used to cancel the request
*/
public final Cancellable updateAsync(UpdateRequest updateRequest, RequestOptions options, ActionListener listener) {
- return performRequestAsyncAndParseEntity(updateRequest, RequestConverters::update, options, UpdateResponse::fromXContent, listener,
- emptySet());
+ return performRequestAsyncAndParseEntity(
+ updateRequest,
+ RequestConverters::update,
+ options,
+ UpdateResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -866,8 +1048,13 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public final DeleteResponse delete(DeleteRequest deleteRequest, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(deleteRequest, RequestConverters::delete, options, DeleteResponse::fromXContent,
- singleton(404));
+ return performRequestAndParseEntity(
+ deleteRequest,
+ RequestConverters::delete,
+ options,
+ DeleteResponse::fromXContent,
+ singleton(404)
+ );
}
/**
@@ -879,8 +1066,14 @@ public class RestHighLevelClient implements Closeable {
* @return cancellable that may be used to cancel the request
*/
public final Cancellable deleteAsync(DeleteRequest deleteRequest, RequestOptions options, ActionListener listener) {
- return performRequestAsyncAndParseEntity(deleteRequest, RequestConverters::delete, options, DeleteResponse::fromXContent, listener,
- Collections.singleton(404));
+ return performRequestAsyncAndParseEntity(
+ deleteRequest,
+ RequestConverters::delete,
+ options,
+ DeleteResponse::fromXContent,
+ listener,
+ Collections.singleton(404)
+ );
}
/**
@@ -892,11 +1085,12 @@ public class RestHighLevelClient implements Closeable {
*/
public final SearchResponse search(SearchRequest searchRequest, RequestOptions options) throws IOException {
return performRequestAndParseEntity(
- searchRequest,
- r -> RequestConverters.search(r, "_search"),
- options,
- SearchResponse::fromXContent,
- emptySet());
+ searchRequest,
+ r -> RequestConverters.search(r, "_search"),
+ options,
+ SearchResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -909,12 +1103,13 @@ public class RestHighLevelClient implements Closeable {
*/
public final Cancellable searchAsync(SearchRequest searchRequest, RequestOptions options, ActionListener listener) {
return performRequestAsyncAndParseEntity(
- searchRequest,
- r -> RequestConverters.search(r, "_search"),
- options,
- SearchResponse::fromXContent,
- listener,
- emptySet());
+ searchRequest,
+ r -> RequestConverters.search(r, "_search"),
+ options,
+ SearchResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -938,8 +1133,13 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public final MultiSearchResponse msearch(MultiSearchRequest multiSearchRequest, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(multiSearchRequest, RequestConverters::multiSearch, options, MultiSearchResponse::fromXContext,
- emptySet());
+ return performRequestAndParseEntity(
+ multiSearchRequest,
+ RequestConverters::multiSearch,
+ options,
+ MultiSearchResponse::fromXContext,
+ emptySet()
+ );
}
/**
@@ -952,8 +1152,11 @@ public class RestHighLevelClient implements Closeable {
* @return cancellable that may be used to cancel the request
*/
@Deprecated
- public final Cancellable multiSearchAsync(MultiSearchRequest searchRequest, RequestOptions options,
- ActionListener listener) {
+ public final Cancellable multiSearchAsync(
+ MultiSearchRequest searchRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
return msearchAsync(searchRequest, options, listener);
}
@@ -965,10 +1168,19 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable msearchAsync(MultiSearchRequest searchRequest, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(searchRequest, RequestConverters::multiSearch, options, MultiSearchResponse::fromXContext,
- listener, emptySet());
+ public final Cancellable msearchAsync(
+ MultiSearchRequest searchRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ searchRequest,
+ RequestConverters::multiSearch,
+ options,
+ MultiSearchResponse::fromXContext,
+ listener,
+ emptySet()
+ );
}
/**
@@ -992,8 +1204,13 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public final SearchResponse scroll(SearchScrollRequest searchScrollRequest, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(searchScrollRequest, RequestConverters::searchScroll, options, SearchResponse::fromXContent,
- emptySet());
+ return performRequestAndParseEntity(
+ searchScrollRequest,
+ RequestConverters::searchScroll,
+ options,
+ SearchResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1006,8 +1223,11 @@ public class RestHighLevelClient implements Closeable {
* @return cancellable that may be used to cancel the request
*/
@Deprecated
- public final Cancellable searchScrollAsync(SearchScrollRequest searchScrollRequest, RequestOptions options,
- ActionListener listener) {
+ public final Cancellable searchScrollAsync(
+ SearchScrollRequest searchScrollRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
return scrollAsync(searchScrollRequest, options, listener);
}
@@ -1019,10 +1239,19 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable scrollAsync(SearchScrollRequest searchScrollRequest, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(searchScrollRequest, RequestConverters::searchScroll,
- options, SearchResponse::fromXContent, listener, emptySet());
+ public final Cancellable scrollAsync(
+ SearchScrollRequest searchScrollRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ searchScrollRequest,
+ RequestConverters::searchScroll,
+ options,
+ SearchResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1033,8 +1262,13 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public final ClearScrollResponse clearScroll(ClearScrollRequest clearScrollRequest, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(clearScrollRequest, RequestConverters::clearScroll, options, ClearScrollResponse::fromXContent,
- emptySet());
+ return performRequestAndParseEntity(
+ clearScrollRequest,
+ RequestConverters::clearScroll,
+ options,
+ ClearScrollResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1045,10 +1279,19 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable clearScrollAsync(ClearScrollRequest clearScrollRequest, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(clearScrollRequest, RequestConverters::clearScroll,
- options, ClearScrollResponse::fromXContent, listener, emptySet());
+ public final Cancellable clearScrollAsync(
+ ClearScrollRequest clearScrollRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ clearScrollRequest,
+ RequestConverters::clearScroll,
+ options,
+ ClearScrollResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1058,10 +1301,15 @@ public class RestHighLevelClient implements Closeable {
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return the response
*/
- public final SearchTemplateResponse searchTemplate(SearchTemplateRequest searchTemplateRequest,
- RequestOptions options) throws IOException {
- return performRequestAndParseEntity(searchTemplateRequest, RequestConverters::searchTemplate, options,
- SearchTemplateResponse::fromXContent, emptySet());
+ public final SearchTemplateResponse searchTemplate(SearchTemplateRequest searchTemplateRequest, RequestOptions options)
+ throws IOException {
+ return performRequestAndParseEntity(
+ searchTemplateRequest,
+ RequestConverters::searchTemplate,
+ options,
+ SearchTemplateResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1069,10 +1317,19 @@ public class RestHighLevelClient implements Closeable {
*
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable searchTemplateAsync(SearchTemplateRequest searchTemplateRequest, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(searchTemplateRequest, RequestConverters::searchTemplate, options,
- SearchTemplateResponse::fromXContent, listener, emptySet());
+ public final Cancellable searchTemplateAsync(
+ SearchTemplateRequest searchTemplateRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ searchTemplateRequest,
+ RequestConverters::searchTemplate,
+ options,
+ SearchTemplateResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1083,13 +1340,13 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public final ExplainResponse explain(ExplainRequest explainRequest, RequestOptions options) throws IOException {
- return performRequest(explainRequest, RequestConverters::explain, options,
- response -> {
- CheckedFunction entityParser =
- parser -> ExplainResponse.fromXContent(parser, convertExistsResponse(response));
- return parseEntity(response.getEntity(), entityParser);
- },
- singleton(404));
+ return performRequest(explainRequest, RequestConverters::explain, options, response -> {
+ CheckedFunction entityParser = parser -> ExplainResponse.fromXContent(
+ parser,
+ convertExistsResponse(response)
+ );
+ return parseEntity(response.getEntity(), entityParser);
+ }, singleton(404));
}
/**
@@ -1101,16 +1358,15 @@ public class RestHighLevelClient implements Closeable {
* @return cancellable that may be used to cancel the request
*/
public final Cancellable explainAsync(ExplainRequest explainRequest, RequestOptions options, ActionListener listener) {
- return performRequestAsync(explainRequest, RequestConverters::explain, options,
- response -> {
- CheckedFunction entityParser =
- parser -> ExplainResponse.fromXContent(parser, convertExistsResponse(response));
- return parseEntity(response.getEntity(), entityParser);
- },
- listener, singleton(404));
+ return performRequestAsync(explainRequest, RequestConverters::explain, options, response -> {
+ CheckedFunction entityParser = parser -> ExplainResponse.fromXContent(
+ parser,
+ convertExistsResponse(response)
+ );
+ return parseEntity(response.getEntity(), entityParser);
+ }, listener, singleton(404));
}
-
/**
* Calls the Term Vectors API
*
@@ -1118,8 +1374,13 @@ public class RestHighLevelClient implements Closeable {
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
*/
public final TermVectorsResponse termvectors(TermVectorsRequest request, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(request, RequestConverters::termVectors, options, TermVectorsResponse::fromXContent,
- emptySet());
+ return performRequestAndParseEntity(
+ request,
+ RequestConverters::termVectors,
+ options,
+ TermVectorsResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1130,14 +1391,21 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable termvectorsAsync(TermVectorsRequest request, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(request, RequestConverters::termVectors, options,
- TermVectorsResponse::fromXContent, listener,
- emptySet());
+ public final Cancellable termvectorsAsync(
+ TermVectorsRequest request,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ request,
+ RequestConverters::termVectors,
+ options,
+ TermVectorsResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
-
/**
* Calls the Multi Term Vectors API
*
@@ -1146,10 +1414,14 @@ public class RestHighLevelClient implements Closeable {
*/
public final MultiTermVectorsResponse mtermvectors(MultiTermVectorsRequest request, RequestOptions options) throws IOException {
return performRequestAndParseEntity(
- request, RequestConverters::mtermVectors, options, MultiTermVectorsResponse::fromXContent, emptySet());
+ request,
+ RequestConverters::mtermVectors,
+ options,
+ MultiTermVectorsResponse::fromXContent,
+ emptySet()
+ );
}
-
/**
* Asynchronously calls the Multi Term Vectors API
*
@@ -1158,13 +1430,21 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable mtermvectorsAsync(MultiTermVectorsRequest request, RequestOptions options,
- ActionListener listener) {
+ public final Cancellable mtermvectorsAsync(
+ MultiTermVectorsRequest request,
+ RequestOptions options,
+ ActionListener listener
+ ) {
return performRequestAsyncAndParseEntity(
- request, RequestConverters::mtermVectors, options, MultiTermVectorsResponse::fromXContent, listener, emptySet());
+ request,
+ RequestConverters::mtermVectors,
+ options,
+ MultiTermVectorsResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
-
/**
* Executes a request using the Ranking Evaluation API.
*
@@ -1173,19 +1453,28 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public final RankEvalResponse rankEval(RankEvalRequest rankEvalRequest, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(rankEvalRequest, RequestConverters::rankEval, options, RankEvalResponse::fromXContent,
- emptySet());
+ return performRequestAndParseEntity(
+ rankEvalRequest,
+ RequestConverters::rankEval,
+ options,
+ RankEvalResponse::fromXContent,
+ emptySet()
+ );
}
-
/**
* Executes a request using the Multi Search Template API.
*
*/
- public final MultiSearchTemplateResponse msearchTemplate(MultiSearchTemplateRequest multiSearchTemplateRequest,
- RequestOptions options) throws IOException {
- return performRequestAndParseEntity(multiSearchTemplateRequest, RequestConverters::multiSearchTemplate,
- options, MultiSearchTemplateResponse::fromXContext, emptySet());
+ public final MultiSearchTemplateResponse msearchTemplate(MultiSearchTemplateRequest multiSearchTemplateRequest, RequestOptions options)
+ throws IOException {
+ return performRequestAndParseEntity(
+ multiSearchTemplateRequest,
+ RequestConverters::multiSearchTemplate,
+ options,
+ MultiSearchTemplateResponse::fromXContext,
+ emptySet()
+ );
}
/**
@@ -1193,11 +1482,19 @@ public class RestHighLevelClient implements Closeable {
*
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable msearchTemplateAsync(MultiSearchTemplateRequest multiSearchTemplateRequest,
- RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(multiSearchTemplateRequest, RequestConverters::multiSearchTemplate,
- options, MultiSearchTemplateResponse::fromXContext, listener, emptySet());
+ public final Cancellable msearchTemplateAsync(
+ MultiSearchTemplateRequest multiSearchTemplateRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ multiSearchTemplateRequest,
+ RequestConverters::multiSearchTemplate,
+ options,
+ MultiSearchTemplateResponse::fromXContext,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1208,11 +1505,19 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable rankEvalAsync(RankEvalRequest rankEvalRequest, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(rankEvalRequest, RequestConverters::rankEval, options,
- RankEvalResponse::fromXContent, listener,
- emptySet());
+ public final Cancellable rankEvalAsync(
+ RankEvalRequest rankEvalRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ rankEvalRequest,
+ RequestConverters::rankEval,
+ options,
+ RankEvalResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1222,10 +1527,15 @@ public class RestHighLevelClient implements Closeable {
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return the response
*/
- public final FieldCapabilitiesResponse fieldCaps(FieldCapabilitiesRequest fieldCapabilitiesRequest,
- RequestOptions options) throws IOException {
- return performRequestAndParseEntity(fieldCapabilitiesRequest, RequestConverters::fieldCaps, options,
- FieldCapabilitiesResponse::fromXContent, emptySet());
+ public final FieldCapabilitiesResponse fieldCaps(FieldCapabilitiesRequest fieldCapabilitiesRequest, RequestOptions options)
+ throws IOException {
+ return performRequestAndParseEntity(
+ fieldCapabilitiesRequest,
+ RequestConverters::fieldCaps,
+ options,
+ FieldCapabilitiesResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1236,8 +1546,13 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public GetStoredScriptResponse getScript(GetStoredScriptRequest request, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(request, RequestConverters::getScript, options,
- GetStoredScriptResponse::fromXContent, emptySet());
+ return performRequestAndParseEntity(
+ request,
+ RequestConverters::getScript,
+ options,
+ GetStoredScriptResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1248,10 +1563,19 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable getScriptAsync(GetStoredScriptRequest request, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(request, RequestConverters::getScript, options,
- GetStoredScriptResponse::fromXContent, listener, emptySet());
+ public Cancellable getScriptAsync(
+ GetStoredScriptRequest request,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ request,
+ RequestConverters::getScript,
+ options,
+ GetStoredScriptResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1262,8 +1586,13 @@ public class RestHighLevelClient implements Closeable {
* @return the response
*/
public AcknowledgedResponse deleteScript(DeleteStoredScriptRequest request, RequestOptions options) throws IOException {
- return performRequestAndParseEntity(request, RequestConverters::deleteScript, options,
- AcknowledgedResponse::fromXContent, emptySet());
+ return performRequestAndParseEntity(
+ request,
+ RequestConverters::deleteScript,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1274,10 +1603,19 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable deleteScriptAsync(DeleteStoredScriptRequest request, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(request, RequestConverters::deleteScript, options,
- AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable deleteScriptAsync(
+ DeleteStoredScriptRequest request,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ request,
+ RequestConverters::deleteScript,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1287,10 +1625,14 @@ public class RestHighLevelClient implements Closeable {
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return the response
*/
- public AcknowledgedResponse putScript(PutStoredScriptRequest putStoredScriptRequest,
- RequestOptions options) throws IOException {
- return performRequestAndParseEntity(putStoredScriptRequest, RequestConverters::putScript, options,
- AcknowledgedResponse::fromXContent, emptySet());
+ public AcknowledgedResponse putScript(PutStoredScriptRequest putStoredScriptRequest, RequestOptions options) throws IOException {
+ return performRequestAndParseEntity(
+ putStoredScriptRequest,
+ RequestConverters::putScript,
+ options,
+ AcknowledgedResponse::fromXContent,
+ emptySet()
+ );
}
/**
@@ -1301,10 +1643,19 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public Cancellable putScriptAsync(PutStoredScriptRequest putStoredScriptRequest, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(putStoredScriptRequest, RequestConverters::putScript, options,
- AcknowledgedResponse::fromXContent, listener, emptySet());
+ public Cancellable putScriptAsync(
+ PutStoredScriptRequest putStoredScriptRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ putStoredScriptRequest,
+ RequestConverters::putScript,
+ options,
+ AcknowledgedResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1315,10 +1666,19 @@ public class RestHighLevelClient implements Closeable {
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
- public final Cancellable fieldCapsAsync(FieldCapabilitiesRequest fieldCapabilitiesRequest, RequestOptions options,
- ActionListener listener) {
- return performRequestAsyncAndParseEntity(fieldCapabilitiesRequest, RequestConverters::fieldCaps, options,
- FieldCapabilitiesResponse::fromXContent, listener, emptySet());
+ public final Cancellable fieldCapsAsync(
+ FieldCapabilitiesRequest fieldCapabilitiesRequest,
+ RequestOptions options,
+ ActionListener listener
+ ) {
+ return performRequestAsyncAndParseEntity(
+ fieldCapabilitiesRequest,
+ RequestConverters::fieldCaps,
+ options,
+ FieldCapabilitiesResponse::fromXContent,
+ listener,
+ emptySet()
+ );
}
/**
@@ -1326,25 +1686,27 @@ public class RestHighLevelClient implements Closeable {
* layer has been added to the ReST client, and requests should extend {@link Validatable} instead of {@link ActionRequest}.
*/
@Deprecated
- protected final Resp performRequestAndParseEntity(Req request,
- CheckedFunction requestConverter,
- RequestOptions options,
- CheckedFunction entityParser,
- Set ignores) throws IOException {
- return performRequest(request, requestConverter, options,
- response -> parseEntity(response.getEntity(), entityParser), ignores);
+ protected final Resp performRequestAndParseEntity(
+ Req request,
+ CheckedFunction requestConverter,
+ RequestOptions options,
+ CheckedFunction entityParser,
+ Set ignores
+ ) throws IOException {
+ return performRequest(request, requestConverter, options, response -> parseEntity(response.getEntity(), entityParser), ignores);
}
/**
* Defines a helper method for performing a request and then parsing the returned entity using the provided entityParser.
*/
- protected final Resp performRequestAndParseEntity(Req request,
- CheckedFunction requestConverter,
- RequestOptions options,
- CheckedFunction entityParser,
- Set ignores) throws IOException {
- return performRequest(request, requestConverter, options,
- response -> parseEntity(response.getEntity(), entityParser), ignores);
+ protected final Resp performRequestAndParseEntity(
+ Req request,
+ CheckedFunction requestConverter,
+ RequestOptions options,
+ CheckedFunction entityParser,
+ Set ignores
+ ) throws IOException {
+ return performRequest(request, requestConverter, options, response -> parseEntity(response.getEntity(), entityParser), ignores);
}
/**
@@ -1352,11 +1714,13 @@ public class RestHighLevelClient implements Closeable {
* layer has been added to the ReST client, and requests should extend {@link Validatable} instead of {@link ActionRequest}.
*/
@Deprecated
- protected final Resp performRequest(Req request,
- CheckedFunction requestConverter,
- RequestOptions options,
- CheckedFunction responseConverter,
- Set ignores) throws IOException {
+ protected final Resp performRequest(
+ Req request,
+ CheckedFunction requestConverter,
+ RequestOptions options,
+ CheckedFunction responseConverter,
+ Set ignores
+ ) throws IOException {
ActionRequestValidationException validationException = request.validate();
if (validationException != null && validationException.validationErrors().isEmpty() == false) {
throw validationException;
@@ -1367,11 +1731,13 @@ public class RestHighLevelClient implements Closeable {
/**
* Defines a helper method for performing a request.
*/
- protected final Resp performRequest(Req request,
- CheckedFunction requestConverter,
- RequestOptions options,
- CheckedFunction responseConverter,
- Set ignores) throws IOException {
+ protected final Resp performRequest(
+ Req request,
+ CheckedFunction requestConverter,
+ RequestOptions options,
+ CheckedFunction responseConverter,
+ Set ignores
+ ) throws IOException {
Optional validationException = request.validate();
if (validationException != null && validationException.isPresent()) {
throw validationException.get();
@@ -1382,11 +1748,13 @@ public class RestHighLevelClient implements Closeable {
/**
* Provides common functionality for performing a request.
*/
- private Resp internalPerformRequest(Req request,
- CheckedFunction requestConverter,
- RequestOptions options,
- CheckedFunction responseConverter,
- Set ignores) throws IOException {
+ private Resp internalPerformRequest(
+ Req request,
+ CheckedFunction requestConverter,
+ RequestOptions options,
+ CheckedFunction responseConverter,
+ Set ignores
+ ) throws IOException {
Request req = requestConverter.apply(request);
req.setOptions(options);
Response response;
@@ -1409,7 +1777,7 @@ public class RestHighLevelClient implements Closeable {
try {
return responseConverter.apply(response);
- } catch(Exception e) {
+ } catch (Exception e) {
throw new IOException("Unable to parse response body for " + response, e);
}
}
@@ -1418,11 +1786,12 @@ public class RestHighLevelClient implements Closeable {
* Defines a helper method for requests that can 404 and in which case will return an empty Optional
* otherwise tries to parse the response body
*/
- protected final Optional performRequestAndParseOptionalEntity(Req request,
- CheckedFunction requestConverter,
- RequestOptions options,
- CheckedFunction