All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.elastic.clients.elasticsearch.ElasticsearchAsyncClient Maven / Gradle / Ivy

/*
 * 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.
 */

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.connector.ElasticsearchConnectorAsyncClient;
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.HealthReportRequest;
import co.elastic.clients.elasticsearch.core.HealthReportResponse;
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.SearchMvtRequest;
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.esql.ElasticsearchEsqlAsyncClient;
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.inference.ElasticsearchInferenceAsyncClient;
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.query_rules.ElasticsearchQueryRulesAsyncClient;
import co.elastic.clients.elasticsearch.rollup.ElasticsearchRollupAsyncClient;
import co.elastic.clients.elasticsearch.search_application.ElasticsearchSearchApplicationAsyncClient;
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.synonyms.ElasticsearchSynonymsAsyncClient;
import co.elastic.clients.elasticsearch.tasks.ElasticsearchTasksAsyncClient;
import co.elastic.clients.elasticsearch.text_structure.ElasticsearchTextStructureAsyncClient;
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.BinaryResponse;
import co.elastic.clients.transport.endpoints.BooleanResponse;
import co.elastic.clients.transport.endpoints.EndpointWithResponseMapperAttr;
import co.elastic.clients.util.ObjectBuilder;
import java.lang.reflect.Type;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import javax.annotation.Nullable;

//----------------------------------------------------------------
//       THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------------------
//
// This code is generated from the Elasticsearch API specification
// at https://github.com/elastic/elasticsearch-specification
//
// Manual updates to this file will be lost when the code is
// re-generated.
//
// If you find a property that is missing or wrongly typed, please
// open an issue or a PR on the API specification repository.
//
//----------------------------------------------------------------

/**
 * 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 ElasticsearchConnectorAsyncClient connector() {
		return new ElasticsearchConnectorAsyncClient(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 ElasticsearchEsqlAsyncClient esql() {
		return new ElasticsearchEsqlAsyncClient(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 ElasticsearchInferenceAsyncClient inference() {
		return new ElasticsearchInferenceAsyncClient(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 ElasticsearchQueryRulesAsyncClient queryRules() {
		return new ElasticsearchQueryRulesAsyncClient(this.transport, this.transportOptions);
	}

	public ElasticsearchRollupAsyncClient rollup() {
		return new ElasticsearchRollupAsyncClient(this.transport, this.transportOptions);
	}

	public ElasticsearchSearchApplicationAsyncClient searchApplication() {
		return new ElasticsearchSearchApplicationAsyncClient(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 ElasticsearchSynonymsAsyncClient synonyms() {
		return new ElasticsearchSynonymsAsyncClient(this.transport, this.transportOptions);
	}

	public ElasticsearchTasksAsyncClient tasks() {
		return new ElasticsearchTasksAsyncClient(this.transport, this.transportOptions);
	}

	public ElasticsearchTextStructureAsyncClient textStructure() {
		return new ElasticsearchTextStructureAsyncClient(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

	/**
	 * Performs multiple indexing or delete operations in a single API call. This
	 * reduces overhead and can greatly increase indexing speed.
	 * 
	 * @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);
	}

	/**
	 * Performs multiple indexing or delete operations in a single API call. This
	 * reduces overhead and can greatly increase indexing speed.
	 * 
	 * @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());
	}

	/**
	 * Performs multiple indexing or delete operations in a single API call. This
	 * reduces overhead and can greatly increase indexing speed.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public CompletableFuture bulk() {
		return this.transport.performRequestAsync(new BulkRequest.Builder().build(), BulkRequest._ENDPOINT,
				this.transportOptions);
	}

	// ----- Endpoint: clear_scroll

	/**
	 * Clears the search context and results for a scrolling search.
	 * 
	 * @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);
	}

	/**
	 * Clears the search context and results for a scrolling search.
	 * 
	 * @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());
	}

	/**
	 * Clears the search context and results for a scrolling search.
	 * 
	 * @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

	/**
	 * Closes 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);
	}

	/**
	 * Closes 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

	/**
	 * Adds a JSON document to the specified data stream or index and makes it
	 * searchable. If the target is an index and the document already exists, the
	 * request updates the document and increments its version.
	 * 
	 * @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);
	}

	/**
	 * Adds a JSON document to the specified data stream or index and makes it
	 * searchable. If the target is an index and the document already exists, the
	 * request updates the document and increments its version.
	 * 
	 * @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 JSON document from the specified 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 JSON document from the specified 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 that match the specified 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 that match the specified 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 stored script or search template.
	 * 
	 * @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 stored script or search template.
	 * 
	 * @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

	/**
	 * Checks if a document in an index exists.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public CompletableFuture exists(ExistsRequest request) {
		@SuppressWarnings("unchecked")
		Endpoint endpoint = (Endpoint) ExistsRequest._ENDPOINT;

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Checks if a document in an index exists.
	 * 
	 * @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

	/**
	 * Checks if a document's _source is stored.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public CompletableFuture existsSource(ExistsSourceRequest request) {
		@SuppressWarnings("unchecked")
		Endpoint endpoint = (Endpoint) ExistsSourceRequest._ENDPOINT;

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Checks if a document's _source is stored.
	 * 
	 * @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 document 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.Response.TDocument", getDeserializer(tDocumentClass));

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Returns information about why a specific document 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);
	}

	/**
	 * Returns information about why a specific document matches (or doesn’t match)
	 * a query.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public  CompletableFuture> explain(ExplainRequest request,
			Type tDocumentType) {
		@SuppressWarnings("unchecked")
		JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ExplainRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:_global.explain.Response.TDocument", getDeserializer(tDocumentType));

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Returns information about why a specific document 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, Type tDocumentType) {
		return explain(fn.apply(new ExplainRequest.Builder()).build(), tDocumentType);
	}

	// ----- Endpoint: field_caps

	/**
	 * The field capabilities API returns the information about the capabilities of
	 * fields among multiple indices. The field capabilities API returns runtime
	 * fields like any other field. For example, a runtime field with a type of
	 * keyword is returned as any other field that belongs to the
	 * keyword family.
	 * 
	 * @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);
	}

	/**
	 * The field capabilities API returns the information about the capabilities of
	 * fields among multiple indices. The field capabilities API returns runtime
	 * fields like any other field. For example, a runtime field with a type of
	 * keyword is returned as any other field that belongs to the
	 * keyword family.
	 * 
	 * @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());
	}

	/**
	 * The field capabilities API returns the information about the capabilities of
	 * fields among multiple indices. The field capabilities API returns runtime
	 * fields like any other field. For example, a runtime field with a type of
	 * keyword is returned as any other field that belongs to the
	 * keyword family.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public CompletableFuture fieldCaps() {
		return this.transport.performRequestAsync(new FieldCapsRequest.Builder().build(), FieldCapsRequest._ENDPOINT,
				this.transportOptions);
	}

	// ----- 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.Response.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);
	}

	/**
	 * Returns a document.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public  CompletableFuture> get(GetRequest request, Type tDocumentType) {
		@SuppressWarnings("unchecked")
		JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:_global.get.Response.TDocument", getDeserializer(tDocumentType));

		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, Type tDocumentType) {
		return get(fn.apply(new GetRequest.Builder()).build(), tDocumentType);
	}

	// ----- Endpoint: get_script

	/**
	 * Retrieves a stored script or search template.
	 * 
	 * @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);
	}

	/**
	 * Retrieves a stored script or search template.
	 * 
	 * @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.Response.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);
	}

	/**
	 * Returns the source of a document.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public  CompletableFuture> getSource(GetSourceRequest request,
			Type tDocumentType) {
		@SuppressWarnings("unchecked")
		JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetSourceRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:_global.get_source.Response.TDocument",
				getDeserializer(tDocumentType));

		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, Type tDocumentType) {
		return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentType);
	}

	// ----- Endpoint: health_report

	/**
	 * Returns the health of the cluster.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public CompletableFuture healthReport(HealthReportRequest request) {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) HealthReportRequest._ENDPOINT;

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Returns the health of the cluster.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link HealthReportRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final CompletableFuture healthReport(
			Function> fn) {
		return healthReport(fn.apply(new HealthReportRequest.Builder()).build());
	}

	/**
	 * Returns the health of the cluster.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public CompletableFuture healthReport() {
		return this.transport.performRequestAsync(new HealthReportRequest.Builder().build(),
				HealthReportRequest._ENDPOINT, this.transportOptions);
	}

	// ----- Endpoint: index

	/**
	 * Adds a JSON document to the specified data stream or index and makes it
	 * searchable. If the target is an index and the document already exists, the
	 * request updates the document and increments its version.
	 * 
	 * @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);
	}

	/**
	 * Adds a JSON document to the specified data stream or index and makes it
	 * searchable. If the target is an index and the document already exists, the
	 * request updates the document and increments its version.
	 * 
	 * @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.Response.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);
	}

	/**
	 * Performs a kNN search.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public  CompletableFuture> knnSearch(KnnSearchRequest request,
			Type tDocumentType) {
		@SuppressWarnings("unchecked")
		JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) KnnSearchRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:_global.knn_search.Response.TDocument",
				getDeserializer(tDocumentType));

		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, Type tDocumentType) {
		return knnSearch(fn.apply(new KnnSearchRequest.Builder()).build(), tDocumentType);
	}

	// ----- 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.Response.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);
	}

	/**
	 * Allows to get multiple documents in one request.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public  CompletableFuture> mget(MgetRequest request, Type tDocumentType) {
		@SuppressWarnings("unchecked")
		JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MgetRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:_global.mget.Response.TDocument", getDeserializer(tDocumentType));

		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, Type tDocumentType) {
		return mget(fn.apply(new MgetRequest.Builder()).build(), tDocumentType);
	}

	// ----- 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.Response.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);
	}

	/**
	 * Allows to execute several search operations in one request.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public  CompletableFuture> msearch(MsearchRequest request,
			Type tDocumentType) {
		@SuppressWarnings("unchecked")
		JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MsearchRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:_global.msearch.Response.TDocument", getDeserializer(tDocumentType));

		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, Type tDocumentType) {
		return msearch(fn.apply(new MsearchRequest.Builder()).build(), tDocumentType);
	}

	// ----- Endpoint: msearch_template

	/**
	 * Runs multiple templated searches with a single 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.Response.TDocument",
				getDeserializer(tDocumentClass));

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Runs multiple templated searches with a single 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);
	}

	/**
	 * Runs multiple templated searches with a single request.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public  CompletableFuture> msearchTemplate(
			MsearchTemplateRequest request, Type tDocumentType) {
		@SuppressWarnings("unchecked")
		JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) MsearchTemplateRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:_global.msearch_template.Response.TDocument",
				getDeserializer(tDocumentType));

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Runs multiple templated searches with a single 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, Type tDocumentType) {
		return msearchTemplate(fn.apply(new MsearchTemplateRequest.Builder()).build(), tDocumentType);
	}

	// ----- 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

	/**
	 * A search request by default executes against the most recent visible data of
	 * the target indices, which is called point in time. Elasticsearch pit (point
	 * in time) is a lightweight view into the state of the data as it existed when
	 * initiated. In some cases, it’s preferred to perform multiple search requests
	 * using the same point in time. For example, if refreshes happen between
	 * search_after requests, then the results of those requests might
	 * not be consistent as changes happening between searches are only visible to
	 * the more recent point in time.
	 * 
	 * @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);
	}

	/**
	 * A search request by default executes against the most recent visible data of
	 * the target indices, which is called point in time. Elasticsearch pit (point
	 * in time) is a lightweight view into the state of the data as it existed when
	 * initiated. In some cases, it’s preferred to perform multiple search requests
	 * using the same point in time. For example, if refreshes happen between
	 * search_after requests, then the results of those requests might
	 * not be consistent as changes happening between searches are only visible to
	 * the more recent point in time.
	 * 
	 * @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 stored script or search template.
	 * 
	 * @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 stored script or search template.
	 * 
	 * @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

	/**
	 * Enables you 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);
	}

	/**
	 * Enables you 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

	/**
	 * Copies documents from a source to a destination.
	 * 
	 * @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);
	}

	/**
	 * Copies documents from a source to a destination.
	 * 
	 * @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

	/**
	 * Renders a search template as a search request body.
	 * 
	 * @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);
	}

	/**
	 * Renders a search template as a search request body.
	 * 
	 * @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());
	}

	/**
	 * Renders a search template as a search request body.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public CompletableFuture renderSearchTemplate() {
		return this.transport.performRequestAsync(new RenderSearchTemplateRequest.Builder().build(),
				RenderSearchTemplateRequest._ENDPOINT, this.transportOptions);
	}

	// ----- Endpoint: scripts_painless_execute

	/**
	 * Runs a script and returns a result.
	 * 
	 * @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.Response.TResult",
				getDeserializer(tResultClass));

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Runs a script and returns a result.
	 * 
	 * @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);
	}

	/**
	 * Runs a script and returns a result.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public  CompletableFuture> scriptsPainlessExecute(
			ScriptsPainlessExecuteRequest request, Type tResultType) {
		@SuppressWarnings("unchecked")
		JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ScriptsPainlessExecuteRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:_global.scripts_painless_execute.Response.TResult",
				getDeserializer(tResultType));

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Runs a script and returns a result.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link ScriptsPainlessExecuteRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final  CompletableFuture> scriptsPainlessExecute(
			Function> fn,
			Type tResultType) {
		return scriptsPainlessExecute(fn.apply(new ScriptsPainlessExecuteRequest.Builder()).build(), tResultType);
	}

	// ----- 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.Response.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);
	}

	/**
	 * Allows to retrieve a large numbers of results from a single search request.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public  CompletableFuture> scroll(ScrollRequest request, Type tDocumentType) {
		@SuppressWarnings("unchecked")
		JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) ScrollRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:_global.scroll.Response.TDocument", getDeserializer(tDocumentType));

		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, Type tDocumentType) {
		return scroll(fn.apply(new ScrollRequest.Builder()).build(), tDocumentType);
	}

	// ----- Endpoint: search

	/**
	 * Returns search hits that match the query defined in the request. You can
	 * provide search queries using the q query string parameter or the
	 * request body. If both are specified, only the query parameter is used.
	 * 
	 * @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.Response.TDocument", getDeserializer(tDocumentClass));

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Returns search hits that match the query defined in the request. You can
	 * provide search queries using the q query string parameter or the
	 * request body. If both are specified, only the query parameter is used.
	 * 
	 * @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);
	}

	/**
	 * Returns search hits that match the query defined in the request. You can
	 * provide search queries using the q query string parameter or the
	 * request body. If both are specified, only the query parameter is used.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public  CompletableFuture> search(SearchRequest request, Type tDocumentType) {
		@SuppressWarnings("unchecked")
		JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SearchRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:_global.search.Response.TDocument", getDeserializer(tDocumentType));

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Returns search hits that match the query defined in the request. You can
	 * provide search queries using the q query string parameter or the
	 * request body. If both are specified, only the query parameter is used.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link SearchRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final  CompletableFuture> search(
			Function> fn, Type tDocumentType) {
		return search(fn.apply(new SearchRequest.Builder()).build(), tDocumentType);
	}

	// ----- Endpoint: search_mvt

	/**
	 * Searches a vector tile for geospatial values. Returns results as a binary
	 * Mapbox vector tile.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public CompletableFuture searchMvt(SearchMvtRequest request) {
		@SuppressWarnings("unchecked")
		Endpoint endpoint = (Endpoint) SearchMvtRequest._ENDPOINT;

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Searches a vector tile for geospatial values. Returns results as a binary
	 * Mapbox vector tile.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link SearchMvtRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final CompletableFuture searchMvt(
			Function> fn) {
		return searchMvt(fn.apply(new SearchMvtRequest.Builder()).build());
	}

	// ----- 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

	/**
	 * Runs a search with a search template.
	 * 
	 * @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.Response.TDocument",
				getDeserializer(tDocumentClass));

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Runs a search with a search template.
	 * 
	 * @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);
	}

	/**
	 * Runs a search with a search template.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public  CompletableFuture> searchTemplate(
			SearchTemplateRequest request, Type tDocumentType) {
		@SuppressWarnings("unchecked")
		JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SearchTemplateRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:_global.search_template.Response.TDocument",
				getDeserializer(tDocumentType));

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Runs a search with a search template.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link SearchTemplateRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final  CompletableFuture> searchTemplate(
			Function> fn, Type tDocumentType) {
		return searchTemplate(fn.apply(new SearchTemplateRequest.Builder()).build(), tDocumentType);
	}

	// ----- 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 tDocumentClass) {
		@SuppressWarnings("unchecked")
		JsonEndpoint, UpdateResponse, ErrorResponse> endpoint = (JsonEndpoint, UpdateResponse, ErrorResponse>) UpdateRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:_global.update.Response.TDocument", getDeserializer(tDocumentClass));

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Updates a document with a script or partial document.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link UpdateRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final  CompletableFuture> update(
			Function, ObjectBuilder>> fn,
			Class tDocumentClass) {
		return update(fn.apply(new UpdateRequest.Builder()).build(), tDocumentClass);
	}

	/**
	 * Updates a document with a script or partial document.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public  CompletableFuture> update(
			UpdateRequest request, Type tDocumentType) {
		@SuppressWarnings("unchecked")
		JsonEndpoint, UpdateResponse, ErrorResponse> endpoint = (JsonEndpoint, UpdateResponse, ErrorResponse>) UpdateRequest._ENDPOINT;
		endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
				"co.elastic.clients:Deserializer:_global.update.Response.TDocument", getDeserializer(tDocumentType));

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Updates a document with a script or partial document.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link UpdateRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final  CompletableFuture> update(
			Function, ObjectBuilder>> fn,
			Type tDocumentType) {
		return update(fn.apply(new UpdateRequest.Builder()).build(), tDocumentType);
	}

	// ----- Endpoint: update_by_query

	/**
	 * Updates documents that match the specified query. If no query is specified,
	 * performs an update on every document in the data stream or index without
	 * modifying the source, which is useful for picking up mapping changes.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public CompletableFuture updateByQuery(UpdateByQueryRequest request) {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) UpdateByQueryRequest._ENDPOINT;

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Updates documents that match the specified query. If no query is specified,
	 * performs an update on every document in the data stream or index without
	 * modifying the source, which is useful for picking up mapping changes.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link UpdateByQueryRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final CompletableFuture updateByQuery(
			Function> fn) {
		return updateByQuery(fn.apply(new UpdateByQueryRequest.Builder()).build());
	}

	// ----- Endpoint: update_by_query_rethrottle

	/**
	 * Changes the number of requests per second for a particular Update By Query
	 * operation.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

	public CompletableFuture updateByQueryRethrottle(
			UpdateByQueryRethrottleRequest request) {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) UpdateByQueryRethrottleRequest._ENDPOINT;

		return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
	}

	/**
	 * Changes the number of requests per second for a particular Update By Query
	 * operation.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link UpdateByQueryRethrottleRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

	public final CompletableFuture updateByQueryRethrottle(
			Function> fn) {
		return updateByQueryRethrottle(fn.apply(new UpdateByQueryRethrottleRequest.Builder()).build());
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy