co.elastic.clients.elasticsearch.ElasticsearchAsyncClient Maven / Gradle / Ivy
Show all versions of elasticsearch-java Show documentation
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------
package co.elastic.clients.elasticsearch;
import co.elastic.clients.ApiClient;
import co.elastic.clients.elasticsearch._types.ErrorResponse;
import co.elastic.clients.elasticsearch.async_search.ElasticsearchAsyncSearchAsyncClient;
import co.elastic.clients.elasticsearch.autoscaling.ElasticsearchAutoscalingAsyncClient;
import co.elastic.clients.elasticsearch.cat.ElasticsearchCatAsyncClient;
import co.elastic.clients.elasticsearch.ccr.ElasticsearchCcrAsyncClient;
import co.elastic.clients.elasticsearch.cluster.ElasticsearchClusterAsyncClient;
import co.elastic.clients.elasticsearch.core.BulkRequest;
import co.elastic.clients.elasticsearch.core.BulkResponse;
import co.elastic.clients.elasticsearch.core.ClearScrollRequest;
import co.elastic.clients.elasticsearch.core.ClearScrollResponse;
import co.elastic.clients.elasticsearch.core.ClosePointInTimeRequest;
import co.elastic.clients.elasticsearch.core.ClosePointInTimeResponse;
import co.elastic.clients.elasticsearch.core.CountRequest;
import co.elastic.clients.elasticsearch.core.CountResponse;
import co.elastic.clients.elasticsearch.core.CreateRequest;
import co.elastic.clients.elasticsearch.core.CreateResponse;
import co.elastic.clients.elasticsearch.core.DeleteByQueryRequest;
import co.elastic.clients.elasticsearch.core.DeleteByQueryResponse;
import co.elastic.clients.elasticsearch.core.DeleteByQueryRethrottleRequest;
import co.elastic.clients.elasticsearch.core.DeleteByQueryRethrottleResponse;
import co.elastic.clients.elasticsearch.core.DeleteRequest;
import co.elastic.clients.elasticsearch.core.DeleteResponse;
import co.elastic.clients.elasticsearch.core.DeleteScriptRequest;
import co.elastic.clients.elasticsearch.core.DeleteScriptResponse;
import co.elastic.clients.elasticsearch.core.ExistsRequest;
import co.elastic.clients.elasticsearch.core.ExistsSourceRequest;
import co.elastic.clients.elasticsearch.core.ExplainRequest;
import co.elastic.clients.elasticsearch.core.ExplainResponse;
import co.elastic.clients.elasticsearch.core.FieldCapsRequest;
import co.elastic.clients.elasticsearch.core.FieldCapsResponse;
import co.elastic.clients.elasticsearch.core.GetRequest;
import co.elastic.clients.elasticsearch.core.GetResponse;
import co.elastic.clients.elasticsearch.core.GetScriptContextRequest;
import co.elastic.clients.elasticsearch.core.GetScriptContextResponse;
import co.elastic.clients.elasticsearch.core.GetScriptLanguagesRequest;
import co.elastic.clients.elasticsearch.core.GetScriptLanguagesResponse;
import co.elastic.clients.elasticsearch.core.GetScriptRequest;
import co.elastic.clients.elasticsearch.core.GetScriptResponse;
import co.elastic.clients.elasticsearch.core.GetSourceRequest;
import co.elastic.clients.elasticsearch.core.GetSourceResponse;
import co.elastic.clients.elasticsearch.core.IndexRequest;
import co.elastic.clients.elasticsearch.core.IndexResponse;
import co.elastic.clients.elasticsearch.core.InfoRequest;
import co.elastic.clients.elasticsearch.core.InfoResponse;
import co.elastic.clients.elasticsearch.core.KnnSearchRequest;
import co.elastic.clients.elasticsearch.core.KnnSearchResponse;
import co.elastic.clients.elasticsearch.core.MgetRequest;
import co.elastic.clients.elasticsearch.core.MgetResponse;
import co.elastic.clients.elasticsearch.core.MsearchRequest;
import co.elastic.clients.elasticsearch.core.MsearchResponse;
import co.elastic.clients.elasticsearch.core.MsearchTemplateRequest;
import co.elastic.clients.elasticsearch.core.MsearchTemplateResponse;
import co.elastic.clients.elasticsearch.core.MtermvectorsRequest;
import co.elastic.clients.elasticsearch.core.MtermvectorsResponse;
import co.elastic.clients.elasticsearch.core.OpenPointInTimeRequest;
import co.elastic.clients.elasticsearch.core.OpenPointInTimeResponse;
import co.elastic.clients.elasticsearch.core.PingRequest;
import co.elastic.clients.elasticsearch.core.PutScriptRequest;
import co.elastic.clients.elasticsearch.core.PutScriptResponse;
import co.elastic.clients.elasticsearch.core.RankEvalRequest;
import co.elastic.clients.elasticsearch.core.RankEvalResponse;
import co.elastic.clients.elasticsearch.core.ReindexRequest;
import co.elastic.clients.elasticsearch.core.ReindexResponse;
import co.elastic.clients.elasticsearch.core.ReindexRethrottleRequest;
import co.elastic.clients.elasticsearch.core.ReindexRethrottleResponse;
import co.elastic.clients.elasticsearch.core.RenderSearchTemplateRequest;
import co.elastic.clients.elasticsearch.core.RenderSearchTemplateResponse;
import co.elastic.clients.elasticsearch.core.ScriptsPainlessExecuteRequest;
import co.elastic.clients.elasticsearch.core.ScriptsPainlessExecuteResponse;
import co.elastic.clients.elasticsearch.core.ScrollRequest;
import co.elastic.clients.elasticsearch.core.ScrollResponse;
import co.elastic.clients.elasticsearch.core.SearchRequest;
import co.elastic.clients.elasticsearch.core.SearchResponse;
import co.elastic.clients.elasticsearch.core.SearchShardsRequest;
import co.elastic.clients.elasticsearch.core.SearchShardsResponse;
import co.elastic.clients.elasticsearch.core.SearchTemplateRequest;
import co.elastic.clients.elasticsearch.core.SearchTemplateResponse;
import co.elastic.clients.elasticsearch.core.TermsEnumRequest;
import co.elastic.clients.elasticsearch.core.TermsEnumResponse;
import co.elastic.clients.elasticsearch.core.TermvectorsRequest;
import co.elastic.clients.elasticsearch.core.TermvectorsResponse;
import co.elastic.clients.elasticsearch.core.UpdateByQueryRequest;
import co.elastic.clients.elasticsearch.core.UpdateByQueryResponse;
import co.elastic.clients.elasticsearch.core.UpdateByQueryRethrottleRequest;
import co.elastic.clients.elasticsearch.core.UpdateByQueryRethrottleResponse;
import co.elastic.clients.elasticsearch.core.UpdateRequest;
import co.elastic.clients.elasticsearch.core.UpdateResponse;
import co.elastic.clients.elasticsearch.dangling_indices.ElasticsearchDanglingIndicesAsyncClient;
import co.elastic.clients.elasticsearch.enrich.ElasticsearchEnrichAsyncClient;
import co.elastic.clients.elasticsearch.eql.ElasticsearchEqlAsyncClient;
import co.elastic.clients.elasticsearch.features.ElasticsearchFeaturesAsyncClient;
import co.elastic.clients.elasticsearch.fleet.ElasticsearchFleetAsyncClient;
import co.elastic.clients.elasticsearch.graph.ElasticsearchGraphAsyncClient;
import co.elastic.clients.elasticsearch.ilm.ElasticsearchIlmAsyncClient;
import co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesAsyncClient;
import co.elastic.clients.elasticsearch.ingest.ElasticsearchIngestAsyncClient;
import co.elastic.clients.elasticsearch.license.ElasticsearchLicenseAsyncClient;
import co.elastic.clients.elasticsearch.logstash.ElasticsearchLogstashAsyncClient;
import co.elastic.clients.elasticsearch.migration.ElasticsearchMigrationAsyncClient;
import co.elastic.clients.elasticsearch.ml.ElasticsearchMlAsyncClient;
import co.elastic.clients.elasticsearch.monitoring.ElasticsearchMonitoringAsyncClient;
import co.elastic.clients.elasticsearch.nodes.ElasticsearchNodesAsyncClient;
import co.elastic.clients.elasticsearch.rollup.ElasticsearchRollupAsyncClient;
import co.elastic.clients.elasticsearch.searchable_snapshots.ElasticsearchSearchableSnapshotsAsyncClient;
import co.elastic.clients.elasticsearch.security.ElasticsearchSecurityAsyncClient;
import co.elastic.clients.elasticsearch.shutdown.ElasticsearchShutdownAsyncClient;
import co.elastic.clients.elasticsearch.slm.ElasticsearchSlmAsyncClient;
import co.elastic.clients.elasticsearch.snapshot.ElasticsearchSnapshotAsyncClient;
import co.elastic.clients.elasticsearch.sql.ElasticsearchSqlAsyncClient;
import co.elastic.clients.elasticsearch.ssl.ElasticsearchSslAsyncClient;
import co.elastic.clients.elasticsearch.tasks.ElasticsearchTasksAsyncClient;
import co.elastic.clients.elasticsearch.transform.ElasticsearchTransformAsyncClient;
import co.elastic.clients.elasticsearch.watcher.ElasticsearchWatcherAsyncClient;
import co.elastic.clients.elasticsearch.xpack.ElasticsearchXpackAsyncClient;
import co.elastic.clients.transport.ElasticsearchTransport;
import co.elastic.clients.transport.Endpoint;
import co.elastic.clients.transport.JsonEndpoint;
import co.elastic.clients.transport.Transport;
import co.elastic.clients.transport.TransportOptions;
import co.elastic.clients.transport.endpoints.BooleanResponse;
import co.elastic.clients.transport.endpoints.EndpointWithResponseMapperAttr;
import co.elastic.clients.util.ObjectBuilder;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import javax.annotation.Nullable;
/**
* Client for the namespace.
*/
public class ElasticsearchAsyncClient extends ApiClient {
public ElasticsearchAsyncClient(ElasticsearchTransport transport) {
super(transport, null);
}
public ElasticsearchAsyncClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) {
super(transport, transportOptions);
}
@Override
public ElasticsearchAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) {
return new ElasticsearchAsyncClient(this.transport, transportOptions);
}
// ----- Child clients
public ElasticsearchAsyncSearchAsyncClient asyncSearch() {
return new ElasticsearchAsyncSearchAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchAutoscalingAsyncClient autoscaling() {
return new ElasticsearchAutoscalingAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchCatAsyncClient cat() {
return new ElasticsearchCatAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchCcrAsyncClient ccr() {
return new ElasticsearchCcrAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchClusterAsyncClient cluster() {
return new ElasticsearchClusterAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchDanglingIndicesAsyncClient danglingIndices() {
return new ElasticsearchDanglingIndicesAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchEnrichAsyncClient enrich() {
return new ElasticsearchEnrichAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchEqlAsyncClient eql() {
return new ElasticsearchEqlAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchFeaturesAsyncClient features() {
return new ElasticsearchFeaturesAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchFleetAsyncClient fleet() {
return new ElasticsearchFleetAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchGraphAsyncClient graph() {
return new ElasticsearchGraphAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchIlmAsyncClient ilm() {
return new ElasticsearchIlmAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchIndicesAsyncClient indices() {
return new ElasticsearchIndicesAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchIngestAsyncClient ingest() {
return new ElasticsearchIngestAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchLicenseAsyncClient license() {
return new ElasticsearchLicenseAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchLogstashAsyncClient logstash() {
return new ElasticsearchLogstashAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchMigrationAsyncClient migration() {
return new ElasticsearchMigrationAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchMlAsyncClient ml() {
return new ElasticsearchMlAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchMonitoringAsyncClient monitoring() {
return new ElasticsearchMonitoringAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchNodesAsyncClient nodes() {
return new ElasticsearchNodesAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchRollupAsyncClient rollup() {
return new ElasticsearchRollupAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchSearchableSnapshotsAsyncClient searchableSnapshots() {
return new ElasticsearchSearchableSnapshotsAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchSecurityAsyncClient security() {
return new ElasticsearchSecurityAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchShutdownAsyncClient shutdown() {
return new ElasticsearchShutdownAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchSlmAsyncClient slm() {
return new ElasticsearchSlmAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchSnapshotAsyncClient snapshot() {
return new ElasticsearchSnapshotAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchSqlAsyncClient sql() {
return new ElasticsearchSqlAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchSslAsyncClient ssl() {
return new ElasticsearchSslAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchTasksAsyncClient tasks() {
return new ElasticsearchTasksAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchTransformAsyncClient transform() {
return new ElasticsearchTransformAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchWatcherAsyncClient watcher() {
return new ElasticsearchWatcherAsyncClient(this.transport, this.transportOptions);
}
public ElasticsearchXpackAsyncClient xpack() {
return new ElasticsearchXpackAsyncClient(this.transport, this.transportOptions);
}
// ----- Endpoint: bulk
/**
* Allows to perform multiple index/update/delete operations in a single
* request.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture bulk(BulkRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) BulkRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Allows to perform multiple index/update/delete operations in a single
* request.
*
* @param fn
* a function that initializes a builder to create the
* {@link BulkRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture bulk(Function> fn) {
return bulk(fn.apply(new BulkRequest.Builder()).build());
}
/**
* Allows to perform multiple index/update/delete operations in a single
* request.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture bulk() {
return this.transport.performRequestAsync(new BulkRequest.Builder().build(), BulkRequest._ENDPOINT,
this.transportOptions);
}
// ----- Endpoint: clear_scroll
/**
* Explicitly clears the search context for a scroll.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture clearScroll(ClearScrollRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) ClearScrollRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Explicitly clears the search context for a scroll.
*
* @param fn
* a function that initializes a builder to create the
* {@link ClearScrollRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture clearScroll(
Function> fn) {
return clearScroll(fn.apply(new ClearScrollRequest.Builder()).build());
}
/**
* Explicitly clears the search context for a scroll.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture clearScroll() {
return this.transport.performRequestAsync(new ClearScrollRequest.Builder().build(),
ClearScrollRequest._ENDPOINT, this.transportOptions);
}
// ----- Endpoint: close_point_in_time
/**
* Close a point in time
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture closePointInTime(ClosePointInTimeRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) ClosePointInTimeRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Close a point in time
*
* @param fn
* a function that initializes a builder to create the
* {@link ClosePointInTimeRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture closePointInTime(
Function> fn) {
return closePointInTime(fn.apply(new ClosePointInTimeRequest.Builder()).build());
}
// ----- Endpoint: count
/**
* Returns number of documents matching a query.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture count(CountRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) CountRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Returns number of documents matching a query.
*
* @param fn
* a function that initializes a builder to create the
* {@link CountRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture count(
Function> fn) {
return count(fn.apply(new CountRequest.Builder()).build());
}
/**
* Returns number of documents matching a query.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture count() {
return this.transport.performRequestAsync(new CountRequest.Builder().build(), CountRequest._ENDPOINT,
this.transportOptions);
}
// ----- Endpoint: create
/**
* Creates a new document in the index.
*
* Returns a 409 response when a document with a same ID already exists in the
* index.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture create(CreateRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint, CreateResponse, ErrorResponse> endpoint = (JsonEndpoint, CreateResponse, ErrorResponse>) CreateRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Creates a new document in the index.
*
* Returns a 409 response when a document with a same ID already exists in the
* index.
*
* @param fn
* a function that initializes a builder to create the
* {@link CreateRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture create(
Function, ObjectBuilder>> fn) {
return create(fn.apply(new CreateRequest.Builder()).build());
}
// ----- Endpoint: delete
/**
* Removes a document from the index.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture delete(DeleteRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) DeleteRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Removes a document from the index.
*
* @param fn
* a function that initializes a builder to create the
* {@link DeleteRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture delete(
Function> fn) {
return delete(fn.apply(new DeleteRequest.Builder()).build());
}
// ----- Endpoint: delete_by_query
/**
* Deletes documents matching the provided query.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture deleteByQuery(DeleteByQueryRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) DeleteByQueryRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Deletes documents matching the provided query.
*
* @param fn
* a function that initializes a builder to create the
* {@link DeleteByQueryRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture deleteByQuery(
Function> fn) {
return deleteByQuery(fn.apply(new DeleteByQueryRequest.Builder()).build());
}
// ----- Endpoint: delete_by_query_rethrottle
/**
* Changes the number of requests per second for a particular Delete By Query
* operation.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture deleteByQueryRethrottle(
DeleteByQueryRethrottleRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) DeleteByQueryRethrottleRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Changes the number of requests per second for a particular Delete By Query
* operation.
*
* @param fn
* a function that initializes a builder to create the
* {@link DeleteByQueryRethrottleRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture deleteByQueryRethrottle(
Function> fn) {
return deleteByQueryRethrottle(fn.apply(new DeleteByQueryRethrottleRequest.Builder()).build());
}
// ----- Endpoint: delete_script
/**
* Deletes a script.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture deleteScript(DeleteScriptRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) DeleteScriptRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Deletes a script.
*
* @param fn
* a function that initializes a builder to create the
* {@link DeleteScriptRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture deleteScript(
Function> fn) {
return deleteScript(fn.apply(new DeleteScriptRequest.Builder()).build());
}
// ----- Endpoint: exists
/**
* Returns information about whether a document exists in an index.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture exists(ExistsRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) ExistsRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Returns information about whether a document exists in an index.
*
* @param fn
* a function that initializes a builder to create the
* {@link ExistsRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture exists(
Function> fn) {
return exists(fn.apply(new ExistsRequest.Builder()).build());
}
// ----- Endpoint: exists_source
/**
* Returns information about whether a document source exists in an index.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture existsSource(ExistsSourceRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) ExistsSourceRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Returns information about whether a document source exists in an index.
*
* @param fn
* a function that initializes a builder to create the
* {@link ExistsSourceRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture existsSource(
Function> fn) {
return existsSource(fn.apply(new ExistsSourceRequest.Builder()).build());
}
// ----- Endpoint: explain
/**
* Returns information about why a specific matches (or doesn't match) a query.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture> explain(ExplainRequest request,
Class tDocumentClass) {
@SuppressWarnings("unchecked")
JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ExplainRequest._ENDPOINT;
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
"co.elastic.clients:Deserializer:_global.explain.TDocument", getDeserializer(tDocumentClass));
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Returns information about why a specific matches (or doesn't match) a query.
*
* @param fn
* a function that initializes a builder to create the
* {@link ExplainRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture> explain(
Function> fn, Class tDocumentClass) {
return explain(fn.apply(new ExplainRequest.Builder()).build(), tDocumentClass);
}
// ----- Endpoint: field_caps
/**
* Returns the information about the capabilities of fields among multiple
* indices.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture fieldCaps(FieldCapsRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) FieldCapsRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Returns the information about the capabilities of fields among multiple
* indices.
*
* @param fn
* a function that initializes a builder to create the
* {@link FieldCapsRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture fieldCaps(
Function> fn) {
return fieldCaps(fn.apply(new FieldCapsRequest.Builder()).build());
}
// ----- Endpoint: get
/**
* Returns a document.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture> get(GetRequest request,
Class tDocumentClass) {
@SuppressWarnings("unchecked")
JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetRequest._ENDPOINT;
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
"co.elastic.clients:Deserializer:_global.get.TDocument", getDeserializer(tDocumentClass));
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Returns a document.
*
* @param fn
* a function that initializes a builder to create the
* {@link GetRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture> get(
Function> fn, Class tDocumentClass) {
return get(fn.apply(new GetRequest.Builder()).build(), tDocumentClass);
}
// ----- Endpoint: get_script
/**
* Returns a script.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture getScript(GetScriptRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) GetScriptRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Returns a script.
*
* @param fn
* a function that initializes a builder to create the
* {@link GetScriptRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture getScript(
Function> fn) {
return getScript(fn.apply(new GetScriptRequest.Builder()).build());
}
// ----- Endpoint: get_script_context
/**
* Returns all script contexts.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture getScriptContext() {
return this.transport.performRequestAsync(GetScriptContextRequest._INSTANCE, GetScriptContextRequest._ENDPOINT,
this.transportOptions);
}
// ----- Endpoint: get_script_languages
/**
* Returns available script types, languages and contexts
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture getScriptLanguages() {
return this.transport.performRequestAsync(GetScriptLanguagesRequest._INSTANCE,
GetScriptLanguagesRequest._ENDPOINT, this.transportOptions);
}
// ----- Endpoint: get_source
/**
* Returns the source of a document.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture> getSource(GetSourceRequest request,
Class tDocumentClass) {
@SuppressWarnings("unchecked")
JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetSourceRequest._ENDPOINT;
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
"co.elastic.clients:Deserializer:_global.get_source.TDocument", getDeserializer(tDocumentClass));
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Returns the source of a document.
*
* @param fn
* a function that initializes a builder to create the
* {@link GetSourceRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture> getSource(
Function> fn, Class tDocumentClass) {
return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentClass);
}
// ----- Endpoint: index
/**
* Creates or updates a document in an index.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture index(IndexRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint, IndexResponse, ErrorResponse> endpoint = (JsonEndpoint, IndexResponse, ErrorResponse>) IndexRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Creates or updates a document in an index.
*
* @param fn
* a function that initializes a builder to create the
* {@link IndexRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture index(
Function, ObjectBuilder>> fn) {
return index(fn.apply(new IndexRequest.Builder()).build());
}
// ----- Endpoint: info
/**
* Returns basic information about the cluster.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture info() {
return this.transport.performRequestAsync(InfoRequest._INSTANCE, InfoRequest._ENDPOINT, this.transportOptions);
}
// ----- Endpoint: knn_search
/**
* Performs a kNN search.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture> knnSearch(KnnSearchRequest request,
Class tDocumentClass) {
@SuppressWarnings("unchecked")
JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) KnnSearchRequest._ENDPOINT;
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
"co.elastic.clients:Deserializer:_global.knn_search.TDocument", getDeserializer(tDocumentClass));
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Performs a kNN search.
*
* @param fn
* a function that initializes a builder to create the
* {@link KnnSearchRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture> knnSearch(
Function> fn, Class tDocumentClass) {
return knnSearch(fn.apply(new KnnSearchRequest.Builder()).build(), tDocumentClass);
}
// ----- Endpoint: mget
/**
* Allows to get multiple documents in one request.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture> mget(MgetRequest request,
Class tDocumentClass) {
@SuppressWarnings("unchecked")
JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MgetRequest._ENDPOINT;
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
"co.elastic.clients:Deserializer:_global.mget.TDocument", getDeserializer(tDocumentClass));
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Allows to get multiple documents in one request.
*
* @param fn
* a function that initializes a builder to create the
* {@link MgetRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture> mget(
Function> fn, Class tDocumentClass) {
return mget(fn.apply(new MgetRequest.Builder()).build(), tDocumentClass);
}
// ----- Endpoint: msearch
/**
* Allows to execute several search operations in one request.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture> msearch(MsearchRequest request,
Class tDocumentClass) {
@SuppressWarnings("unchecked")
JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MsearchRequest._ENDPOINT;
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
"co.elastic.clients:Deserializer:_global.msearch.TDocument", getDeserializer(tDocumentClass));
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Allows to execute several search operations in one request.
*
* @param fn
* a function that initializes a builder to create the
* {@link MsearchRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture> msearch(
Function> fn, Class tDocumentClass) {
return msearch(fn.apply(new MsearchRequest.Builder()).build(), tDocumentClass);
}
// ----- Endpoint: msearch_template
/**
* Allows to execute several search template operations in one request.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture> msearchTemplate(
MsearchTemplateRequest request, Class tDocumentClass) {
@SuppressWarnings("unchecked")
JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MsearchTemplateRequest._ENDPOINT;
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
"co.elastic.clients:Deserializer:_global.msearch_template.TDocument", getDeserializer(tDocumentClass));
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Allows to execute several search template operations in one request.
*
* @param fn
* a function that initializes a builder to create the
* {@link MsearchTemplateRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture> msearchTemplate(
Function> fn,
Class tDocumentClass) {
return msearchTemplate(fn.apply(new MsearchTemplateRequest.Builder()).build(), tDocumentClass);
}
// ----- Endpoint: mtermvectors
/**
* Returns multiple termvectors in one request.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture mtermvectors(MtermvectorsRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) MtermvectorsRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Returns multiple termvectors in one request.
*
* @param fn
* a function that initializes a builder to create the
* {@link MtermvectorsRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture mtermvectors(
Function> fn) {
return mtermvectors(fn.apply(new MtermvectorsRequest.Builder()).build());
}
/**
* Returns multiple termvectors in one request.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture mtermvectors() {
return this.transport.performRequestAsync(new MtermvectorsRequest.Builder().build(),
MtermvectorsRequest._ENDPOINT, this.transportOptions);
}
// ----- Endpoint: open_point_in_time
/**
* Open a point in time that can be used in subsequent searches
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture openPointInTime(OpenPointInTimeRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) OpenPointInTimeRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Open a point in time that can be used in subsequent searches
*
* @param fn
* a function that initializes a builder to create the
* {@link OpenPointInTimeRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture openPointInTime(
Function> fn) {
return openPointInTime(fn.apply(new OpenPointInTimeRequest.Builder()).build());
}
// ----- Endpoint: ping
/**
* Returns whether the cluster is running.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture ping() {
return this.transport.performRequestAsync(PingRequest._INSTANCE, PingRequest._ENDPOINT, this.transportOptions);
}
// ----- Endpoint: put_script
/**
* Creates or updates a script.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture putScript(PutScriptRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) PutScriptRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Creates or updates a script.
*
* @param fn
* a function that initializes a builder to create the
* {@link PutScriptRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture putScript(
Function> fn) {
return putScript(fn.apply(new PutScriptRequest.Builder()).build());
}
// ----- Endpoint: rank_eval
/**
* Allows to evaluate the quality of ranked search results over a set of typical
* search queries
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture rankEval(RankEvalRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) RankEvalRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Allows to evaluate the quality of ranked search results over a set of typical
* search queries
*
* @param fn
* a function that initializes a builder to create the
* {@link RankEvalRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture rankEval(
Function> fn) {
return rankEval(fn.apply(new RankEvalRequest.Builder()).build());
}
// ----- Endpoint: reindex
/**
* Allows to copy documents from one index to another, optionally filtering the
* source documents by a query, changing the destination index settings, or
* fetching the documents from a remote cluster.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture reindex(ReindexRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) ReindexRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Allows to copy documents from one index to another, optionally filtering the
* source documents by a query, changing the destination index settings, or
* fetching the documents from a remote cluster.
*
* @param fn
* a function that initializes a builder to create the
* {@link ReindexRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture reindex(
Function> fn) {
return reindex(fn.apply(new ReindexRequest.Builder()).build());
}
// ----- Endpoint: reindex_rethrottle
/**
* Changes the number of requests per second for a particular Reindex operation.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture reindexRethrottle(ReindexRethrottleRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) ReindexRethrottleRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Changes the number of requests per second for a particular Reindex operation.
*
* @param fn
* a function that initializes a builder to create the
* {@link ReindexRethrottleRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture reindexRethrottle(
Function> fn) {
return reindexRethrottle(fn.apply(new ReindexRethrottleRequest.Builder()).build());
}
// ----- Endpoint: render_search_template
/**
* Allows to use the Mustache language to pre-render a search definition.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture renderSearchTemplate(RenderSearchTemplateRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) RenderSearchTemplateRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Allows to use the Mustache language to pre-render a search definition.
*
* @param fn
* a function that initializes a builder to create the
* {@link RenderSearchTemplateRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture renderSearchTemplate(
Function> fn) {
return renderSearchTemplate(fn.apply(new RenderSearchTemplateRequest.Builder()).build());
}
/**
* Allows to use the Mustache language to pre-render a search definition.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture renderSearchTemplate() {
return this.transport.performRequestAsync(new RenderSearchTemplateRequest.Builder().build(),
RenderSearchTemplateRequest._ENDPOINT, this.transportOptions);
}
// ----- Endpoint: scripts_painless_execute
/**
* Allows an arbitrary script to be executed and a result to be returned
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture> scriptsPainlessExecute(
ScriptsPainlessExecuteRequest request, Class tResultClass) {
@SuppressWarnings("unchecked")
JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ScriptsPainlessExecuteRequest._ENDPOINT;
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
"co.elastic.clients:Deserializer:_global.scripts_painless_execute.TResult",
getDeserializer(tResultClass));
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Allows an arbitrary script to be executed and a result to be returned
*
* @param fn
* a function that initializes a builder to create the
* {@link ScriptsPainlessExecuteRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture> scriptsPainlessExecute(
Function> fn,
Class tResultClass) {
return scriptsPainlessExecute(fn.apply(new ScriptsPainlessExecuteRequest.Builder()).build(), tResultClass);
}
// ----- Endpoint: scroll
/**
* Allows to retrieve a large numbers of results from a single search request.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture> scroll(ScrollRequest request,
Class tDocumentClass) {
@SuppressWarnings("unchecked")
JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ScrollRequest._ENDPOINT;
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
"co.elastic.clients:Deserializer:_global.scroll.TDocument", getDeserializer(tDocumentClass));
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Allows to retrieve a large numbers of results from a single search request.
*
* @param fn
* a function that initializes a builder to create the
* {@link ScrollRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture> scroll(
Function> fn, Class tDocumentClass) {
return scroll(fn.apply(new ScrollRequest.Builder()).build(), tDocumentClass);
}
// ----- Endpoint: search
/**
* Returns results matching a query.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture> search(SearchRequest request,
Class tDocumentClass) {
@SuppressWarnings("unchecked")
JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SearchRequest._ENDPOINT;
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
"co.elastic.clients:Deserializer:_global.search.TDocument", getDeserializer(tDocumentClass));
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Returns results matching a query.
*
* @param fn
* a function that initializes a builder to create the
* {@link SearchRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture> search(
Function> fn, Class tDocumentClass) {
return search(fn.apply(new SearchRequest.Builder()).build(), tDocumentClass);
}
// ----- Endpoint: search_shards
/**
* Returns information about the indices and shards that a search request would
* be executed against.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture searchShards(SearchShardsRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) SearchShardsRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Returns information about the indices and shards that a search request would
* be executed against.
*
* @param fn
* a function that initializes a builder to create the
* {@link SearchShardsRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture searchShards(
Function> fn) {
return searchShards(fn.apply(new SearchShardsRequest.Builder()).build());
}
/**
* Returns information about the indices and shards that a search request would
* be executed against.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture searchShards() {
return this.transport.performRequestAsync(new SearchShardsRequest.Builder().build(),
SearchShardsRequest._ENDPOINT, this.transportOptions);
}
// ----- Endpoint: search_template
/**
* Allows to use the Mustache language to pre-render a search definition.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture> searchTemplate(
SearchTemplateRequest request, Class tDocumentClass) {
@SuppressWarnings("unchecked")
JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SearchTemplateRequest._ENDPOINT;
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
"co.elastic.clients:Deserializer:_global.search_template.TDocument", getDeserializer(tDocumentClass));
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Allows to use the Mustache language to pre-render a search definition.
*
* @param fn
* a function that initializes a builder to create the
* {@link SearchTemplateRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture> searchTemplate(
Function> fn,
Class tDocumentClass) {
return searchTemplate(fn.apply(new SearchTemplateRequest.Builder()).build(), tDocumentClass);
}
// ----- Endpoint: terms_enum
/**
* The terms enum API can be used to discover terms in the index that begin with
* the provided string. It is designed for low-latency look-ups used in
* auto-complete scenarios.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture termsEnum(TermsEnumRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) TermsEnumRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* The terms enum API can be used to discover terms in the index that begin with
* the provided string. It is designed for low-latency look-ups used in
* auto-complete scenarios.
*
* @param fn
* a function that initializes a builder to create the
* {@link TermsEnumRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture termsEnum(
Function> fn) {
return termsEnum(fn.apply(new TermsEnumRequest.Builder()).build());
}
// ----- Endpoint: termvectors
/**
* Returns information and statistics about terms in the fields of a particular
* document.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture termvectors(TermvectorsRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint, TermvectorsResponse, ErrorResponse> endpoint = (JsonEndpoint, TermvectorsResponse, ErrorResponse>) TermvectorsRequest._ENDPOINT;
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}
/**
* Returns information and statistics about terms in the fields of a particular
* document.
*
* @param fn
* a function that initializes a builder to create the
* {@link TermvectorsRequest}
* @see Documentation
* on elastic.co
*/
public final CompletableFuture termvectors(
Function, ObjectBuilder>> fn) {
return termvectors(fn.apply(new TermvectorsRequest.Builder()).build());
}
// ----- Endpoint: update
/**
* Updates a document with a script or partial document.
*
* @see Documentation
* on elastic.co
*/
public CompletableFuture> update(
UpdateRequest request, Class