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

co.elastic.clients.elasticsearch.ElasticsearchClient 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.ElasticsearchException;
import co.elastic.clients.elasticsearch._types.ErrorResponse;
import co.elastic.clients.elasticsearch.async_search.ElasticsearchAsyncSearchClient;
import co.elastic.clients.elasticsearch.autoscaling.ElasticsearchAutoscalingClient;
import co.elastic.clients.elasticsearch.cat.ElasticsearchCatClient;
import co.elastic.clients.elasticsearch.ccr.ElasticsearchCcrClient;
import co.elastic.clients.elasticsearch.cluster.ElasticsearchClusterClient;
import co.elastic.clients.elasticsearch.connector.ElasticsearchConnectorClient;
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.ElasticsearchDanglingIndicesClient;
import co.elastic.clients.elasticsearch.enrich.ElasticsearchEnrichClient;
import co.elastic.clients.elasticsearch.eql.ElasticsearchEqlClient;
import co.elastic.clients.elasticsearch.esql.ElasticsearchEsqlClient;
import co.elastic.clients.elasticsearch.features.ElasticsearchFeaturesClient;
import co.elastic.clients.elasticsearch.fleet.ElasticsearchFleetClient;
import co.elastic.clients.elasticsearch.graph.ElasticsearchGraphClient;
import co.elastic.clients.elasticsearch.ilm.ElasticsearchIlmClient;
import co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient;
import co.elastic.clients.elasticsearch.inference.ElasticsearchInferenceClient;
import co.elastic.clients.elasticsearch.ingest.ElasticsearchIngestClient;
import co.elastic.clients.elasticsearch.license.ElasticsearchLicenseClient;
import co.elastic.clients.elasticsearch.logstash.ElasticsearchLogstashClient;
import co.elastic.clients.elasticsearch.migration.ElasticsearchMigrationClient;
import co.elastic.clients.elasticsearch.ml.ElasticsearchMlClient;
import co.elastic.clients.elasticsearch.monitoring.ElasticsearchMonitoringClient;
import co.elastic.clients.elasticsearch.nodes.ElasticsearchNodesClient;
import co.elastic.clients.elasticsearch.query_rules.ElasticsearchQueryRulesClient;
import co.elastic.clients.elasticsearch.rollup.ElasticsearchRollupClient;
import co.elastic.clients.elasticsearch.search_application.ElasticsearchSearchApplicationClient;
import co.elastic.clients.elasticsearch.searchable_snapshots.ElasticsearchSearchableSnapshotsClient;
import co.elastic.clients.elasticsearch.security.ElasticsearchSecurityClient;
import co.elastic.clients.elasticsearch.shutdown.ElasticsearchShutdownClient;
import co.elastic.clients.elasticsearch.slm.ElasticsearchSlmClient;
import co.elastic.clients.elasticsearch.snapshot.ElasticsearchSnapshotClient;
import co.elastic.clients.elasticsearch.sql.ElasticsearchSqlClient;
import co.elastic.clients.elasticsearch.ssl.ElasticsearchSslClient;
import co.elastic.clients.elasticsearch.synonyms.ElasticsearchSynonymsClient;
import co.elastic.clients.elasticsearch.tasks.ElasticsearchTasksClient;
import co.elastic.clients.elasticsearch.text_structure.ElasticsearchTextStructureClient;
import co.elastic.clients.elasticsearch.transform.ElasticsearchTransformClient;
import co.elastic.clients.elasticsearch.watcher.ElasticsearchWatcherClient;
import co.elastic.clients.elasticsearch.xpack.ElasticsearchXpackClient;
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.io.IOException;
import java.lang.reflect.Type;
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 ElasticsearchClient extends ApiClient {

	public ElasticsearchClient(ElasticsearchTransport transport) {
		super(transport, null);
	}

	public ElasticsearchClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) {
		super(transport, transportOptions);
	}

	@Override
	public ElasticsearchClient withTransportOptions(@Nullable TransportOptions transportOptions) {
		return new ElasticsearchClient(this.transport, transportOptions);
	}

	// ----- Child clients

	public ElasticsearchAsyncSearchClient asyncSearch() {
		return new ElasticsearchAsyncSearchClient(this.transport, this.transportOptions);
	}

	public ElasticsearchAutoscalingClient autoscaling() {
		return new ElasticsearchAutoscalingClient(this.transport, this.transportOptions);
	}

	public ElasticsearchCatClient cat() {
		return new ElasticsearchCatClient(this.transport, this.transportOptions);
	}

	public ElasticsearchCcrClient ccr() {
		return new ElasticsearchCcrClient(this.transport, this.transportOptions);
	}

	public ElasticsearchClusterClient cluster() {
		return new ElasticsearchClusterClient(this.transport, this.transportOptions);
	}

	public ElasticsearchConnectorClient connector() {
		return new ElasticsearchConnectorClient(this.transport, this.transportOptions);
	}

	public ElasticsearchDanglingIndicesClient danglingIndices() {
		return new ElasticsearchDanglingIndicesClient(this.transport, this.transportOptions);
	}

	public ElasticsearchEnrichClient enrich() {
		return new ElasticsearchEnrichClient(this.transport, this.transportOptions);
	}

	public ElasticsearchEqlClient eql() {
		return new ElasticsearchEqlClient(this.transport, this.transportOptions);
	}

	public ElasticsearchEsqlClient esql() {
		return new ElasticsearchEsqlClient(this.transport, this.transportOptions);
	}

	public ElasticsearchFeaturesClient features() {
		return new ElasticsearchFeaturesClient(this.transport, this.transportOptions);
	}

	public ElasticsearchFleetClient fleet() {
		return new ElasticsearchFleetClient(this.transport, this.transportOptions);
	}

	public ElasticsearchGraphClient graph() {
		return new ElasticsearchGraphClient(this.transport, this.transportOptions);
	}

	public ElasticsearchIlmClient ilm() {
		return new ElasticsearchIlmClient(this.transport, this.transportOptions);
	}

	public ElasticsearchIndicesClient indices() {
		return new ElasticsearchIndicesClient(this.transport, this.transportOptions);
	}

	public ElasticsearchInferenceClient inference() {
		return new ElasticsearchInferenceClient(this.transport, this.transportOptions);
	}

	public ElasticsearchIngestClient ingest() {
		return new ElasticsearchIngestClient(this.transport, this.transportOptions);
	}

	public ElasticsearchLicenseClient license() {
		return new ElasticsearchLicenseClient(this.transport, this.transportOptions);
	}

	public ElasticsearchLogstashClient logstash() {
		return new ElasticsearchLogstashClient(this.transport, this.transportOptions);
	}

	public ElasticsearchMigrationClient migration() {
		return new ElasticsearchMigrationClient(this.transport, this.transportOptions);
	}

	public ElasticsearchMlClient ml() {
		return new ElasticsearchMlClient(this.transport, this.transportOptions);
	}

	public ElasticsearchMonitoringClient monitoring() {
		return new ElasticsearchMonitoringClient(this.transport, this.transportOptions);
	}

	public ElasticsearchNodesClient nodes() {
		return new ElasticsearchNodesClient(this.transport, this.transportOptions);
	}

	public ElasticsearchQueryRulesClient queryRules() {
		return new ElasticsearchQueryRulesClient(this.transport, this.transportOptions);
	}

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

	public ElasticsearchSearchApplicationClient searchApplication() {
		return new ElasticsearchSearchApplicationClient(this.transport, this.transportOptions);
	}

	public ElasticsearchSearchableSnapshotsClient searchableSnapshots() {
		return new ElasticsearchSearchableSnapshotsClient(this.transport, this.transportOptions);
	}

	public ElasticsearchSecurityClient security() {
		return new ElasticsearchSecurityClient(this.transport, this.transportOptions);
	}

	public ElasticsearchShutdownClient shutdown() {
		return new ElasticsearchShutdownClient(this.transport, this.transportOptions);
	}

	public ElasticsearchSlmClient slm() {
		return new ElasticsearchSlmClient(this.transport, this.transportOptions);
	}

	public ElasticsearchSnapshotClient snapshot() {
		return new ElasticsearchSnapshotClient(this.transport, this.transportOptions);
	}

	public ElasticsearchSqlClient sql() {
		return new ElasticsearchSqlClient(this.transport, this.transportOptions);
	}

	public ElasticsearchSslClient ssl() {
		return new ElasticsearchSslClient(this.transport, this.transportOptions);
	}

	public ElasticsearchSynonymsClient synonyms() {
		return new ElasticsearchSynonymsClient(this.transport, this.transportOptions);
	}

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

	public ElasticsearchTextStructureClient textStructure() {
		return new ElasticsearchTextStructureClient(this.transport, this.transportOptions);
	}

	public ElasticsearchTransformClient transform() {
		return new ElasticsearchTransformClient(this.transport, this.transportOptions);
	}

	public ElasticsearchWatcherClient watcher() {
		return new ElasticsearchWatcherClient(this.transport, this.transportOptions);
	}

	public ElasticsearchXpackClient xpack() {
		return new ElasticsearchXpackClient(this.transport, this.transportOptions);
	}

	// ----- Endpoint: bulk

	/**
	 * Bulk index or delete documents. 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 BulkResponse bulk(BulkRequest request) throws IOException, ElasticsearchException {
		@SuppressWarnings("unchecked")
		JsonEndpoint endpoint = (JsonEndpoint) BulkRequest._ENDPOINT;

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

	/**
	 * Bulk index or delete documents. 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 BulkResponse bulk(Function> fn)
			throws IOException, ElasticsearchException {
		return bulk(fn.apply(new BulkRequest.Builder()).build());
	}

	/**
	 * Bulk index or delete documents. 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 BulkResponse bulk() throws IOException, ElasticsearchException {
		return this.transport.performRequest(new BulkRequest.Builder().build(), BulkRequest._ENDPOINT,
				this.transportOptions);
	}

	// ----- Endpoint: clear_scroll

	/**
	 * Clear a scrolling search.
	 * 

* Clear the search context and results for a scrolling search. * * @see Documentation * on elastic.co */ public ClearScrollResponse clearScroll(ClearScrollRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) ClearScrollRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Clear a scrolling search. *

* Clear 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 ClearScrollResponse clearScroll( Function> fn) throws IOException, ElasticsearchException { return clearScroll(fn.apply(new ClearScrollRequest.Builder()).build()); } /** * Clear a scrolling search. *

* Clear the search context and results for a scrolling search. * * @see Documentation * on elastic.co */ public ClearScrollResponse clearScroll() throws IOException, ElasticsearchException { return this.transport.performRequest(new ClearScrollRequest.Builder().build(), ClearScrollRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: close_point_in_time /** * Close a point in time. *

* A point in time must be opened explicitly before being used in search * requests. The keep_alive parameter tells Elasticsearch how long * it should persist. A point in time is automatically closed when the * keep_alive period has elapsed. However, keeping points in time * has a cost; close them as soon as they are no longer required for search * requests. * * @see Documentation * on elastic.co */ public ClosePointInTimeResponse closePointInTime(ClosePointInTimeRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) ClosePointInTimeRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Close a point in time. *

* A point in time must be opened explicitly before being used in search * requests. The keep_alive parameter tells Elasticsearch how long * it should persist. A point in time is automatically closed when the * keep_alive period has elapsed. However, keeping points in time * has a cost; close them as soon as they are no longer required for search * requests. * * @param fn * a function that initializes a builder to create the * {@link ClosePointInTimeRequest} * @see Documentation * on elastic.co */ public final ClosePointInTimeResponse closePointInTime( Function> fn) throws IOException, ElasticsearchException { return closePointInTime(fn.apply(new ClosePointInTimeRequest.Builder()).build()); } // ----- Endpoint: count /** * Returns number of documents matching a query. * * @see Documentation * on elastic.co */ public CountResponse count(CountRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) CountRequest._ENDPOINT; return this.transport.performRequest(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 CountResponse count(Function> fn) throws IOException, ElasticsearchException { return count(fn.apply(new CountRequest.Builder()).build()); } /** * Returns number of documents matching a query. * * @see Documentation * on elastic.co */ public CountResponse count() throws IOException, ElasticsearchException { return this.transport.performRequest(new CountRequest.Builder().build(), CountRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: create /** * Index a document. 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 CreateResponse create(CreateRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint, CreateResponse, ErrorResponse> endpoint = (JsonEndpoint, CreateResponse, ErrorResponse>) CreateRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Index a document. 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 CreateResponse create( Function, ObjectBuilder>> fn) throws IOException, ElasticsearchException { return create(fn.apply(new CreateRequest.Builder()).build()); } // ----- Endpoint: delete /** * Delete a document. Removes a JSON document from the specified index. * * @see Documentation * on elastic.co */ public DeleteResponse delete(DeleteRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) DeleteRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Delete a document. 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 DeleteResponse delete(Function> fn) throws IOException, ElasticsearchException { return delete(fn.apply(new DeleteRequest.Builder()).build()); } // ----- Endpoint: delete_by_query /** * Delete documents. Deletes documents that match the specified query. * * @see Documentation * on elastic.co */ public DeleteByQueryResponse deleteByQuery(DeleteByQueryRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) DeleteByQueryRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Delete documents. 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 DeleteByQueryResponse deleteByQuery( Function> fn) throws IOException, ElasticsearchException { return deleteByQuery(fn.apply(new DeleteByQueryRequest.Builder()).build()); } // ----- Endpoint: delete_by_query_rethrottle /** * Throttle a delete by query operation. *

* Change the number of requests per second for a particular delete by query * operation. Rethrottling that speeds up the query takes effect immediately but * rethrotting that slows down the query takes effect after completing the * current batch to prevent scroll timeouts. * * @see Documentation * on elastic.co */ public DeleteByQueryRethrottleResponse deleteByQueryRethrottle(DeleteByQueryRethrottleRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) DeleteByQueryRethrottleRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Throttle a delete by query operation. *

* Change the number of requests per second for a particular delete by query * operation. Rethrottling that speeds up the query takes effect immediately but * rethrotting that slows down the query takes effect after completing the * current batch to prevent scroll timeouts. * * @param fn * a function that initializes a builder to create the * {@link DeleteByQueryRethrottleRequest} * @see Documentation * on elastic.co */ public final DeleteByQueryRethrottleResponse deleteByQueryRethrottle( Function> fn) throws IOException, ElasticsearchException { return deleteByQueryRethrottle(fn.apply(new DeleteByQueryRethrottleRequest.Builder()).build()); } // ----- Endpoint: delete_script /** * Delete a script or search template. Deletes a stored script or search * template. * * @see Documentation * on elastic.co */ public DeleteScriptResponse deleteScript(DeleteScriptRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) DeleteScriptRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Delete a script or search template. 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 DeleteScriptResponse deleteScript( Function> fn) throws IOException, ElasticsearchException { return deleteScript(fn.apply(new DeleteScriptRequest.Builder()).build()); } // ----- Endpoint: exists /** * Check a document. Checks if a specified document exists. * * @see Documentation * on elastic.co */ public BooleanResponse exists(ExistsRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") Endpoint endpoint = (Endpoint) ExistsRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Check a document. Checks if a specified document exists. * * @param fn * a function that initializes a builder to create the * {@link ExistsRequest} * @see Documentation * on elastic.co */ public final BooleanResponse exists(Function> fn) throws IOException, ElasticsearchException { return exists(fn.apply(new ExistsRequest.Builder()).build()); } // ----- Endpoint: exists_source /** * Check for a document source. Checks if a document's _source is * stored. * * @see Documentation * on elastic.co */ public BooleanResponse existsSource(ExistsSourceRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") Endpoint endpoint = (Endpoint) ExistsSourceRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Check for a document source. 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 BooleanResponse existsSource( Function> fn) throws IOException, ElasticsearchException { return existsSource(fn.apply(new ExistsSourceRequest.Builder()).build()); } // ----- Endpoint: explain /** * Explain a document match result. Returns information about why a specific * document matches, or doesn’t match, a query. * * @see Documentation * on elastic.co */ public ExplainResponse explain(ExplainRequest request, Class tDocumentClass) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Explain a document match result. 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 ExplainResponse explain( Function> fn, Class tDocumentClass) throws IOException, ElasticsearchException { return explain(fn.apply(new ExplainRequest.Builder()).build(), tDocumentClass); } /** * Explain a document match result. Returns information about why a specific * document matches, or doesn’t match, a query. * * @see Documentation * on elastic.co */ public ExplainResponse explain(ExplainRequest request, Type tDocumentType) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Explain a document match result. 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 ExplainResponse explain( Function> fn, Type tDocumentType) throws IOException, ElasticsearchException { return explain(fn.apply(new ExplainRequest.Builder()).build(), tDocumentType); } // ----- Endpoint: field_caps /** * Get the field capabilities. *

* Get information about the capabilities of fields among multiple indices. *

* For data streams, the API returns field capabilities among the stream’s * backing indices. It returns runtime fields like any other field. For example, * a runtime field with a type of keyword is returned the same as any other * field that belongs to the keyword family. * * @see Documentation * on elastic.co */ public FieldCapsResponse fieldCaps(FieldCapsRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) FieldCapsRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Get the field capabilities. *

* Get information about the capabilities of fields among multiple indices. *

* For data streams, the API returns field capabilities among the stream’s * backing indices. It returns runtime fields like any other field. For example, * a runtime field with a type of keyword is returned the same 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 FieldCapsResponse fieldCaps(Function> fn) throws IOException, ElasticsearchException { return fieldCaps(fn.apply(new FieldCapsRequest.Builder()).build()); } /** * Get the field capabilities. *

* Get information about the capabilities of fields among multiple indices. *

* For data streams, the API returns field capabilities among the stream’s * backing indices. It returns runtime fields like any other field. For example, * a runtime field with a type of keyword is returned the same as any other * field that belongs to the keyword family. * * @see Documentation * on elastic.co */ public FieldCapsResponse fieldCaps() throws IOException, ElasticsearchException { return this.transport.performRequest(new FieldCapsRequest.Builder().build(), FieldCapsRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: get /** * Get a document by its ID. Retrieves the document with the specified ID from * an index. * * @see Documentation * on elastic.co */ public GetResponse get(GetRequest request, Class tDocumentClass) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Get a document by its ID. Retrieves the document with the specified ID from * an index. * * @param fn * a function that initializes a builder to create the * {@link GetRequest} * @see Documentation * on elastic.co */ public final GetResponse get(Function> fn, Class tDocumentClass) throws IOException, ElasticsearchException { return get(fn.apply(new GetRequest.Builder()).build(), tDocumentClass); } /** * Get a document by its ID. Retrieves the document with the specified ID from * an index. * * @see Documentation * on elastic.co */ public GetResponse get(GetRequest request, Type tDocumentType) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Get a document by its ID. Retrieves the document with the specified ID from * an index. * * @param fn * a function that initializes a builder to create the * {@link GetRequest} * @see Documentation * on elastic.co */ public final GetResponse get(Function> fn, Type tDocumentType) throws IOException, ElasticsearchException { return get(fn.apply(new GetRequest.Builder()).build(), tDocumentType); } // ----- Endpoint: get_script /** * Get a script or search template. Retrieves a stored script or search * template. * * @see Documentation * on elastic.co */ public GetScriptResponse getScript(GetScriptRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) GetScriptRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Get a script or search template. 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 GetScriptResponse getScript(Function> fn) throws IOException, ElasticsearchException { return getScript(fn.apply(new GetScriptRequest.Builder()).build()); } // ----- Endpoint: get_script_context /** * Get script contexts. *

* Get a list of supported script contexts and their methods. * * @see Documentation * on elastic.co */ public GetScriptContextResponse getScriptContext() throws IOException, ElasticsearchException { return this.transport.performRequest(GetScriptContextRequest._INSTANCE, GetScriptContextRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: get_script_languages /** * Get script languages. *

* Get a list of available script types, languages, and contexts. * * @see Documentation * on elastic.co */ public GetScriptLanguagesResponse getScriptLanguages() throws IOException, ElasticsearchException { return this.transport.performRequest(GetScriptLanguagesRequest._INSTANCE, GetScriptLanguagesRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: get_source /** * Get a document's source. Returns the source of a document. * * @see Documentation * on elastic.co */ public GetSourceResponse getSource(GetSourceRequest request, Class tDocumentClass) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Get a document's source. 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 GetSourceResponse getSource( Function> fn, Class tDocumentClass) throws IOException, ElasticsearchException { return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentClass); } /** * Get a document's source. Returns the source of a document. * * @see Documentation * on elastic.co */ public GetSourceResponse getSource(GetSourceRequest request, Type tDocumentType) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Get a document's source. 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 GetSourceResponse getSource( Function> fn, Type tDocumentType) throws IOException, ElasticsearchException { return getSource(fn.apply(new GetSourceRequest.Builder()).build(), tDocumentType); } // ----- Endpoint: health_report /** * Returns the health of the cluster. * * @see Documentation * on elastic.co */ public HealthReportResponse healthReport(HealthReportRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) HealthReportRequest._ENDPOINT; return this.transport.performRequest(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 HealthReportResponse healthReport( Function> fn) throws IOException, ElasticsearchException { return healthReport(fn.apply(new HealthReportRequest.Builder()).build()); } /** * Returns the health of the cluster. * * @see Documentation * on elastic.co */ public HealthReportResponse healthReport() throws IOException, ElasticsearchException { return this.transport.performRequest(new HealthReportRequest.Builder().build(), HealthReportRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: index /** * Index a document. 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 IndexResponse index(IndexRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint, IndexResponse, ErrorResponse> endpoint = (JsonEndpoint, IndexResponse, ErrorResponse>) IndexRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Index a document. 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 IndexResponse index( Function, ObjectBuilder>> fn) throws IOException, ElasticsearchException { return index(fn.apply(new IndexRequest.Builder()).build()); } // ----- Endpoint: info /** * Get cluster info. Returns basic information about the cluster. * * @see Documentation * on elastic.co */ public InfoResponse info() throws IOException, ElasticsearchException { return this.transport.performRequest(InfoRequest._INSTANCE, InfoRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: knn_search /** * Run a knn search. *

* NOTE: The kNN search API has been replaced by the knn option in * the search API. *

* Perform a k-nearest neighbor (kNN) search on a dense_vector field and return * the matching documents. Given a query vector, the API finds the k closest * vectors and returns those documents as search hits. *

* Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like * most kNN algorithms, HNSW is an approximate method that sacrifices result * accuracy for improved search speed. This means the results returned are not * always the true k closest neighbors. *

* The kNN search API supports restricting the search using a filter. The search * will return the top k documents that also match the filter query. * * @see Documentation * on elastic.co */ public KnnSearchResponse knnSearch(KnnSearchRequest request, Class tDocumentClass) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run a knn search. *

* NOTE: The kNN search API has been replaced by the knn option in * the search API. *

* Perform a k-nearest neighbor (kNN) search on a dense_vector field and return * the matching documents. Given a query vector, the API finds the k closest * vectors and returns those documents as search hits. *

* Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like * most kNN algorithms, HNSW is an approximate method that sacrifices result * accuracy for improved search speed. This means the results returned are not * always the true k closest neighbors. *

* The kNN search API supports restricting the search using a filter. The search * will return the top k documents that also match the filter query. * * @param fn * a function that initializes a builder to create the * {@link KnnSearchRequest} * @see Documentation * on elastic.co */ public final KnnSearchResponse knnSearch( Function> fn, Class tDocumentClass) throws IOException, ElasticsearchException { return knnSearch(fn.apply(new KnnSearchRequest.Builder()).build(), tDocumentClass); } /** * Run a knn search. *

* NOTE: The kNN search API has been replaced by the knn option in * the search API. *

* Perform a k-nearest neighbor (kNN) search on a dense_vector field and return * the matching documents. Given a query vector, the API finds the k closest * vectors and returns those documents as search hits. *

* Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like * most kNN algorithms, HNSW is an approximate method that sacrifices result * accuracy for improved search speed. This means the results returned are not * always the true k closest neighbors. *

* The kNN search API supports restricting the search using a filter. The search * will return the top k documents that also match the filter query. * * @see Documentation * on elastic.co */ public KnnSearchResponse knnSearch(KnnSearchRequest request, Type tDocumentType) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run a knn search. *

* NOTE: The kNN search API has been replaced by the knn option in * the search API. *

* Perform a k-nearest neighbor (kNN) search on a dense_vector field and return * the matching documents. Given a query vector, the API finds the k closest * vectors and returns those documents as search hits. *

* Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like * most kNN algorithms, HNSW is an approximate method that sacrifices result * accuracy for improved search speed. This means the results returned are not * always the true k closest neighbors. *

* The kNN search API supports restricting the search using a filter. The search * will return the top k documents that also match the filter query. * * @param fn * a function that initializes a builder to create the * {@link KnnSearchRequest} * @see Documentation * on elastic.co */ public final KnnSearchResponse knnSearch( Function> fn, Type tDocumentType) throws IOException, ElasticsearchException { return knnSearch(fn.apply(new KnnSearchRequest.Builder()).build(), tDocumentType); } // ----- Endpoint: mget /** * Get multiple documents. *

* Get multiple JSON documents by ID from one or more indices. If you specify an * index in the request URI, you only need to specify the document IDs in the * request body. To ensure fast responses, this multi get (mget) API responds * with partial results if one or more shards fail. * * @see Documentation * on elastic.co */ public MgetResponse mget(MgetRequest request, Class tDocumentClass) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Get multiple documents. *

* Get multiple JSON documents by ID from one or more indices. If you specify an * index in the request URI, you only need to specify the document IDs in the * request body. To ensure fast responses, this multi get (mget) API responds * with partial results if one or more shards fail. * * @param fn * a function that initializes a builder to create the * {@link MgetRequest} * @see Documentation * on elastic.co */ public final MgetResponse mget(Function> fn, Class tDocumentClass) throws IOException, ElasticsearchException { return mget(fn.apply(new MgetRequest.Builder()).build(), tDocumentClass); } /** * Get multiple documents. *

* Get multiple JSON documents by ID from one or more indices. If you specify an * index in the request URI, you only need to specify the document IDs in the * request body. To ensure fast responses, this multi get (mget) API responds * with partial results if one or more shards fail. * * @see Documentation * on elastic.co */ public MgetResponse mget(MgetRequest request, Type tDocumentType) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Get multiple documents. *

* Get multiple JSON documents by ID from one or more indices. If you specify an * index in the request URI, you only need to specify the document IDs in the * request body. To ensure fast responses, this multi get (mget) API responds * with partial results if one or more shards fail. * * @param fn * a function that initializes a builder to create the * {@link MgetRequest} * @see Documentation * on elastic.co */ public final MgetResponse mget(Function> fn, Type tDocumentType) throws IOException, ElasticsearchException { return mget(fn.apply(new MgetRequest.Builder()).build(), tDocumentType); } // ----- Endpoint: msearch /** * Run multiple searches. *

* The format of the request is similar to the bulk API format and makes use of * the newline delimited JSON (NDJSON) format. The structure is as follows: * *

	 * header\n
	 * body\n
	 * header\n
	 * body\n
	 * 
	 * 
*

* This structure is specifically optimized to reduce parsing if a specific * search ends up redirected to another node. *

* IMPORTANT: The final line of data must end with a newline character * \n. Each newline character may be preceded by a carriage return * \r. When sending requests to this endpoint the * Content-Type header should be set to * application/x-ndjson. * * @see Documentation * on elastic.co */ public MsearchResponse msearch(MsearchRequest request, Class tDocumentClass) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run multiple searches. *

* The format of the request is similar to the bulk API format and makes use of * the newline delimited JSON (NDJSON) format. The structure is as follows: * *

	 * header\n
	 * body\n
	 * header\n
	 * body\n
	 * 
	 * 
*

* This structure is specifically optimized to reduce parsing if a specific * search ends up redirected to another node. *

* IMPORTANT: The final line of data must end with a newline character * \n. Each newline character may be preceded by a carriage return * \r. When sending requests to this endpoint the * Content-Type header should be set to * application/x-ndjson. * * @param fn * a function that initializes a builder to create the * {@link MsearchRequest} * @see Documentation * on elastic.co */ public final MsearchResponse msearch( Function> fn, Class tDocumentClass) throws IOException, ElasticsearchException { return msearch(fn.apply(new MsearchRequest.Builder()).build(), tDocumentClass); } /** * Run multiple searches. *

* The format of the request is similar to the bulk API format and makes use of * the newline delimited JSON (NDJSON) format. The structure is as follows: * *

	 * header\n
	 * body\n
	 * header\n
	 * body\n
	 * 
	 * 
*

* This structure is specifically optimized to reduce parsing if a specific * search ends up redirected to another node. *

* IMPORTANT: The final line of data must end with a newline character * \n. Each newline character may be preceded by a carriage return * \r. When sending requests to this endpoint the * Content-Type header should be set to * application/x-ndjson. * * @see Documentation * on elastic.co */ public MsearchResponse msearch(MsearchRequest request, Type tDocumentType) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run multiple searches. *

* The format of the request is similar to the bulk API format and makes use of * the newline delimited JSON (NDJSON) format. The structure is as follows: * *

	 * header\n
	 * body\n
	 * header\n
	 * body\n
	 * 
	 * 
*

* This structure is specifically optimized to reduce parsing if a specific * search ends up redirected to another node. *

* IMPORTANT: The final line of data must end with a newline character * \n. Each newline character may be preceded by a carriage return * \r. When sending requests to this endpoint the * Content-Type header should be set to * application/x-ndjson. * * @param fn * a function that initializes a builder to create the * {@link MsearchRequest} * @see Documentation * on elastic.co */ public final MsearchResponse msearch( Function> fn, Type tDocumentType) throws IOException, ElasticsearchException { return msearch(fn.apply(new MsearchRequest.Builder()).build(), tDocumentType); } // ----- Endpoint: msearch_template /** * Run multiple templated searches. * * @see Documentation * on elastic.co */ public MsearchTemplateResponse msearchTemplate(MsearchTemplateRequest request, Class tDocumentClass) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run multiple templated searches. * * @param fn * a function that initializes a builder to create the * {@link MsearchTemplateRequest} * @see Documentation * on elastic.co */ public final MsearchTemplateResponse msearchTemplate( Function> fn, Class tDocumentClass) throws IOException, ElasticsearchException { return msearchTemplate(fn.apply(new MsearchTemplateRequest.Builder()).build(), tDocumentClass); } /** * Run multiple templated searches. * * @see Documentation * on elastic.co */ public MsearchTemplateResponse msearchTemplate(MsearchTemplateRequest request, Type tDocumentType) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run multiple templated searches. * * @param fn * a function that initializes a builder to create the * {@link MsearchTemplateRequest} * @see Documentation * on elastic.co */ public final MsearchTemplateResponse msearchTemplate( Function> fn, Type tDocumentType) throws IOException, ElasticsearchException { return msearchTemplate(fn.apply(new MsearchTemplateRequest.Builder()).build(), tDocumentType); } // ----- Endpoint: mtermvectors /** * Get multiple term vectors. *

* You can specify existing documents by index and ID or provide artificial * documents in the body of the request. You can specify the index in the * request body or request URI. The response contains a docs array * with all the fetched termvectors. Each element has the structure provided by * the termvectors API. * * @see Documentation * on elastic.co */ public MtermvectorsResponse mtermvectors(MtermvectorsRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) MtermvectorsRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Get multiple term vectors. *

* You can specify existing documents by index and ID or provide artificial * documents in the body of the request. You can specify the index in the * request body or request URI. The response contains a docs array * with all the fetched termvectors. Each element has the structure provided by * the termvectors API. * * @param fn * a function that initializes a builder to create the * {@link MtermvectorsRequest} * @see Documentation * on elastic.co */ public final MtermvectorsResponse mtermvectors( Function> fn) throws IOException, ElasticsearchException { return mtermvectors(fn.apply(new MtermvectorsRequest.Builder()).build()); } /** * Get multiple term vectors. *

* You can specify existing documents by index and ID or provide artificial * documents in the body of the request. You can specify the index in the * request body or request URI. The response contains a docs array * with all the fetched termvectors. Each element has the structure provided by * the termvectors API. * * @see Documentation * on elastic.co */ public MtermvectorsResponse mtermvectors() throws IOException, ElasticsearchException { return this.transport.performRequest(new MtermvectorsRequest.Builder().build(), MtermvectorsRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: open_point_in_time /** * Open a point in time. *

* A search request by default runs 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. *

* A point in time must be opened explicitly before being used in search * requests. The keep_alive parameter tells Elasticsearch how long * it should persist. * * @see Documentation * on elastic.co */ public OpenPointInTimeResponse openPointInTime(OpenPointInTimeRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) OpenPointInTimeRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Open a point in time. *

* A search request by default runs 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. *

* A point in time must be opened explicitly before being used in search * requests. The keep_alive parameter tells Elasticsearch how long * it should persist. * * @param fn * a function that initializes a builder to create the * {@link OpenPointInTimeRequest} * @see Documentation * on elastic.co */ public final OpenPointInTimeResponse openPointInTime( Function> fn) throws IOException, ElasticsearchException { return openPointInTime(fn.apply(new OpenPointInTimeRequest.Builder()).build()); } // ----- Endpoint: ping /** * Ping the cluster. Returns whether the cluster is running. * * @see Documentation * on elastic.co */ public BooleanResponse ping() throws IOException, ElasticsearchException { return this.transport.performRequest(PingRequest._INSTANCE, PingRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: put_script /** * Create or update a script or search template. Creates or updates a stored * script or search template. * * @see Documentation * on elastic.co */ public PutScriptResponse putScript(PutScriptRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) PutScriptRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Create or update a script or search template. 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 PutScriptResponse putScript(Function> fn) throws IOException, ElasticsearchException { return putScript(fn.apply(new PutScriptRequest.Builder()).build()); } // ----- Endpoint: rank_eval /** * Evaluate ranked search results. *

* Evaluate the quality of ranked search results over a set of typical search * queries. * * @see Documentation * on elastic.co */ public RankEvalResponse rankEval(RankEvalRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) RankEvalRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Evaluate ranked search results. *

* 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 RankEvalResponse rankEval(Function> fn) throws IOException, ElasticsearchException { return rankEval(fn.apply(new RankEvalRequest.Builder()).build()); } // ----- Endpoint: reindex /** * Reindex documents. Copies documents from a source to a destination. The * source can be any existing index, alias, or data stream. The destination must * differ from the source. For example, you cannot reindex a data stream into * itself. * * @see Documentation * on elastic.co */ public ReindexResponse reindex(ReindexRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) ReindexRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Reindex documents. Copies documents from a source to a destination. The * source can be any existing index, alias, or data stream. The destination must * differ from the source. For example, you cannot reindex a data stream into * itself. * * @param fn * a function that initializes a builder to create the * {@link ReindexRequest} * @see Documentation * on elastic.co */ public final ReindexResponse reindex(Function> fn) throws IOException, ElasticsearchException { return reindex(fn.apply(new ReindexRequest.Builder()).build()); } // ----- Endpoint: reindex_rethrottle /** * Throttle a reindex operation. *

* Change the number of requests per second for a particular reindex operation. * * @see Documentation * on elastic.co */ public ReindexRethrottleResponse reindexRethrottle(ReindexRethrottleRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) ReindexRethrottleRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Throttle a reindex operation. *

* Change 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 ReindexRethrottleResponse reindexRethrottle( Function> fn) throws IOException, ElasticsearchException { return reindexRethrottle(fn.apply(new ReindexRethrottleRequest.Builder()).build()); } // ----- Endpoint: render_search_template /** * Render a search template. *

* Render a search template as a search request body. * * @see Documentation * on elastic.co */ public RenderSearchTemplateResponse renderSearchTemplate(RenderSearchTemplateRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) RenderSearchTemplateRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Render a search template. *

* Render 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 RenderSearchTemplateResponse renderSearchTemplate( Function> fn) throws IOException, ElasticsearchException { return renderSearchTemplate(fn.apply(new RenderSearchTemplateRequest.Builder()).build()); } /** * Render a search template. *

* Render a search template as a search request body. * * @see Documentation * on elastic.co */ public RenderSearchTemplateResponse renderSearchTemplate() throws IOException, ElasticsearchException { return this.transport.performRequest(new RenderSearchTemplateRequest.Builder().build(), RenderSearchTemplateRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: scripts_painless_execute /** * Run a script. Runs a script and returns a result. * * @see Documentation * on elastic.co */ public ScriptsPainlessExecuteResponse scriptsPainlessExecute( ScriptsPainlessExecuteRequest request, Class tResultClass) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run a script. 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 ScriptsPainlessExecuteResponse scriptsPainlessExecute( Function> fn, Class tResultClass) throws IOException, ElasticsearchException { return scriptsPainlessExecute(fn.apply(new ScriptsPainlessExecuteRequest.Builder()).build(), tResultClass); } /** * Run a script. Runs a script and returns a result. * * @see Documentation * on elastic.co */ public ScriptsPainlessExecuteResponse scriptsPainlessExecute( ScriptsPainlessExecuteRequest request, Type tResultType) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run a script. 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 ScriptsPainlessExecuteResponse scriptsPainlessExecute( Function> fn, Type tResultType) throws IOException, ElasticsearchException { return scriptsPainlessExecute(fn.apply(new ScriptsPainlessExecuteRequest.Builder()).build(), tResultType); } // ----- Endpoint: scroll /** * Run a scrolling search. *

* IMPORTANT: The scroll API is no longer recommend for deep pagination. If you * need to preserve the index state while paging through more than 10,000 hits, * use the search_after parameter with a point in time (PIT). *

* The scroll API gets large sets of results from a single scrolling search * request. To get the necessary scroll ID, submit a search API request that * includes an argument for the scroll query parameter. The * scroll parameter indicates how long Elasticsearch should retain * the search context for the request. The search response returns a scroll ID * in the _scroll_id response body parameter. You can then use the * scroll ID with the scroll API to retrieve the next batch of results for the * request. If the Elasticsearch security features are enabled, the access to * the results of a specific scroll ID is restricted to the user or API key that * submitted the search. *

* You can also use the scroll API to specify a new scroll parameter that * extends or shortens the retention period for the search context. *

* IMPORTANT: Results from a scrolling search reflect the state of the index at * the time of the initial search request. Subsequent indexing or document * changes only affect later search and scroll requests. * * @see Documentation * on elastic.co */ public ScrollResponse scroll(ScrollRequest request, Class tDocumentClass) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run a scrolling search. *

* IMPORTANT: The scroll API is no longer recommend for deep pagination. If you * need to preserve the index state while paging through more than 10,000 hits, * use the search_after parameter with a point in time (PIT). *

* The scroll API gets large sets of results from a single scrolling search * request. To get the necessary scroll ID, submit a search API request that * includes an argument for the scroll query parameter. The * scroll parameter indicates how long Elasticsearch should retain * the search context for the request. The search response returns a scroll ID * in the _scroll_id response body parameter. You can then use the * scroll ID with the scroll API to retrieve the next batch of results for the * request. If the Elasticsearch security features are enabled, the access to * the results of a specific scroll ID is restricted to the user or API key that * submitted the search. *

* You can also use the scroll API to specify a new scroll parameter that * extends or shortens the retention period for the search context. *

* IMPORTANT: Results from a scrolling search reflect the state of the index at * the time of the initial search request. Subsequent indexing or document * changes only affect later search and scroll requests. * * @param fn * a function that initializes a builder to create the * {@link ScrollRequest} * @see Documentation * on elastic.co */ public final ScrollResponse scroll( Function> fn, Class tDocumentClass) throws IOException, ElasticsearchException { return scroll(fn.apply(new ScrollRequest.Builder()).build(), tDocumentClass); } /** * Run a scrolling search. *

* IMPORTANT: The scroll API is no longer recommend for deep pagination. If you * need to preserve the index state while paging through more than 10,000 hits, * use the search_after parameter with a point in time (PIT). *

* The scroll API gets large sets of results from a single scrolling search * request. To get the necessary scroll ID, submit a search API request that * includes an argument for the scroll query parameter. The * scroll parameter indicates how long Elasticsearch should retain * the search context for the request. The search response returns a scroll ID * in the _scroll_id response body parameter. You can then use the * scroll ID with the scroll API to retrieve the next batch of results for the * request. If the Elasticsearch security features are enabled, the access to * the results of a specific scroll ID is restricted to the user or API key that * submitted the search. *

* You can also use the scroll API to specify a new scroll parameter that * extends or shortens the retention period for the search context. *

* IMPORTANT: Results from a scrolling search reflect the state of the index at * the time of the initial search request. Subsequent indexing or document * changes only affect later search and scroll requests. * * @see Documentation * on elastic.co */ public ScrollResponse scroll(ScrollRequest request, Type tDocumentType) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run a scrolling search. *

* IMPORTANT: The scroll API is no longer recommend for deep pagination. If you * need to preserve the index state while paging through more than 10,000 hits, * use the search_after parameter with a point in time (PIT). *

* The scroll API gets large sets of results from a single scrolling search * request. To get the necessary scroll ID, submit a search API request that * includes an argument for the scroll query parameter. The * scroll parameter indicates how long Elasticsearch should retain * the search context for the request. The search response returns a scroll ID * in the _scroll_id response body parameter. You can then use the * scroll ID with the scroll API to retrieve the next batch of results for the * request. If the Elasticsearch security features are enabled, the access to * the results of a specific scroll ID is restricted to the user or API key that * submitted the search. *

* You can also use the scroll API to specify a new scroll parameter that * extends or shortens the retention period for the search context. *

* IMPORTANT: Results from a scrolling search reflect the state of the index at * the time of the initial search request. Subsequent indexing or document * changes only affect later search and scroll requests. * * @param fn * a function that initializes a builder to create the * {@link ScrollRequest} * @see Documentation * on elastic.co */ public final ScrollResponse scroll( Function> fn, Type tDocumentType) throws IOException, ElasticsearchException { return scroll(fn.apply(new ScrollRequest.Builder()).build(), tDocumentType); } // ----- Endpoint: search /** * Run a search. *

* Get 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 SearchResponse search(SearchRequest request, Class tDocumentClass) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run a search. *

* Get 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 SearchResponse search( Function> fn, Class tDocumentClass) throws IOException, ElasticsearchException { return search(fn.apply(new SearchRequest.Builder()).build(), tDocumentClass); } /** * Run a search. *

* Get 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 SearchResponse search(SearchRequest request, Type tDocumentType) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run a search. *

* Get 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 SearchResponse search( Function> fn, Type tDocumentType) throws IOException, ElasticsearchException { return search(fn.apply(new SearchRequest.Builder()).build(), tDocumentType); } // ----- Endpoint: search_mvt /** * Search a vector tile. *

* Search a vector tile for geospatial values. * * @see Documentation * on elastic.co */ public BinaryResponse searchMvt(SearchMvtRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") Endpoint endpoint = (Endpoint) SearchMvtRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Search a vector tile. *

* Search a vector tile for geospatial values. * * @param fn * a function that initializes a builder to create the * {@link SearchMvtRequest} * @see Documentation * on elastic.co */ public final BinaryResponse searchMvt(Function> fn) throws IOException, ElasticsearchException { return searchMvt(fn.apply(new SearchMvtRequest.Builder()).build()); } // ----- Endpoint: search_shards /** * Get the search shards. *

* Get the indices and shards that a search request would be run against. This * information can be useful for working out issues or planning optimizations * with routing and shard preferences. When filtered aliases are used, the * filter is returned as part of the indices section. * * @see Documentation * on elastic.co */ public SearchShardsResponse searchShards(SearchShardsRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) SearchShardsRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Get the search shards. *

* Get the indices and shards that a search request would be run against. This * information can be useful for working out issues or planning optimizations * with routing and shard preferences. When filtered aliases are used, the * filter is returned as part of the indices section. * * @param fn * a function that initializes a builder to create the * {@link SearchShardsRequest} * @see Documentation * on elastic.co */ public final SearchShardsResponse searchShards( Function> fn) throws IOException, ElasticsearchException { return searchShards(fn.apply(new SearchShardsRequest.Builder()).build()); } /** * Get the search shards. *

* Get the indices and shards that a search request would be run against. This * information can be useful for working out issues or planning optimizations * with routing and shard preferences. When filtered aliases are used, the * filter is returned as part of the indices section. * * @see Documentation * on elastic.co */ public SearchShardsResponse searchShards() throws IOException, ElasticsearchException { return this.transport.performRequest(new SearchShardsRequest.Builder().build(), SearchShardsRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: search_template /** * Run a search with a search template. * * @see Documentation * on elastic.co */ public SearchTemplateResponse searchTemplate(SearchTemplateRequest request, Class tDocumentClass) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run 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 SearchTemplateResponse searchTemplate( Function> fn, Class tDocumentClass) throws IOException, ElasticsearchException { return searchTemplate(fn.apply(new SearchTemplateRequest.Builder()).build(), tDocumentClass); } /** * Run a search with a search template. * * @see Documentation * on elastic.co */ public SearchTemplateResponse searchTemplate(SearchTemplateRequest request, Type tDocumentType) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Run 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 SearchTemplateResponse searchTemplate( Function> fn, Type tDocumentType) throws IOException, ElasticsearchException { return searchTemplate(fn.apply(new SearchTemplateRequest.Builder()).build(), tDocumentType); } // ----- Endpoint: terms_enum /** * Get terms in an index. *

* Discover terms that match a partial string in an index. This "terms * enum" API is designed for low-latency look-ups used in auto-complete * scenarios. *

* If the complete property in the response is false, the returned * terms set may be incomplete and should be treated as approximate. This can * occur due to a few reasons, such as a request timeout or a node error. *

* NOTE: The terms enum API may return terms from deleted documents. Deleted * documents are initially only marked as deleted. It is not until their * segments are merged that documents are actually deleted. Until that happens, * the terms enum API will return terms from these documents. * * @see Documentation * on elastic.co */ public TermsEnumResponse termsEnum(TermsEnumRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) TermsEnumRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Get terms in an index. *

* Discover terms that match a partial string in an index. This "terms * enum" API is designed for low-latency look-ups used in auto-complete * scenarios. *

* If the complete property in the response is false, the returned * terms set may be incomplete and should be treated as approximate. This can * occur due to a few reasons, such as a request timeout or a node error. *

* NOTE: The terms enum API may return terms from deleted documents. Deleted * documents are initially only marked as deleted. It is not until their * segments are merged that documents are actually deleted. Until that happens, * the terms enum API will return terms from these documents. * * @param fn * a function that initializes a builder to create the * {@link TermsEnumRequest} * @see Documentation * on elastic.co */ public final TermsEnumResponse termsEnum(Function> fn) throws IOException, ElasticsearchException { return termsEnum(fn.apply(new TermsEnumRequest.Builder()).build()); } // ----- Endpoint: termvectors /** * Get term vector information. *

* Get information and statistics about terms in the fields of a particular * document. * * @see Documentation * on elastic.co */ public TermvectorsResponse termvectors(TermvectorsRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint, TermvectorsResponse, ErrorResponse> endpoint = (JsonEndpoint, TermvectorsResponse, ErrorResponse>) TermvectorsRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Get term vector information. *

* Get 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 TermvectorsResponse termvectors( Function, ObjectBuilder>> fn) throws IOException, ElasticsearchException { return termvectors(fn.apply(new TermvectorsRequest.Builder()).build()); } // ----- Endpoint: update /** * Update a document. Updates a document by running a script or passing a * partial document. * * @see Documentation * on elastic.co */ public UpdateResponse update( UpdateRequest request, Class tDocumentClass) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Update a document. Updates a document by running a script or passing a * partial document. * * @param fn * a function that initializes a builder to create the * {@link UpdateRequest} * @see Documentation * on elastic.co */ public final UpdateResponse update( Function, ObjectBuilder>> fn, Class tDocumentClass) throws IOException, ElasticsearchException { return update(fn.apply(new UpdateRequest.Builder()).build(), tDocumentClass); } /** * Update a document. Updates a document by running a script or passing a * partial document. * * @see Documentation * on elastic.co */ public UpdateResponse update( UpdateRequest request, Type tDocumentType) throws IOException, ElasticsearchException { @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.performRequest(request, endpoint, this.transportOptions); } /** * Update a document. Updates a document by running a script or passing a * partial document. * * @param fn * a function that initializes a builder to create the * {@link UpdateRequest} * @see Documentation * on elastic.co */ public final UpdateResponse update( Function, ObjectBuilder>> fn, Type tDocumentType) throws IOException, ElasticsearchException { return update(fn.apply(new UpdateRequest.Builder()).build(), tDocumentType); } // ----- Endpoint: update_by_query /** * Update documents. 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 UpdateByQueryResponse updateByQuery(UpdateByQueryRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) UpdateByQueryRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Update documents. 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 UpdateByQueryResponse updateByQuery( Function> fn) throws IOException, ElasticsearchException { return updateByQuery(fn.apply(new UpdateByQueryRequest.Builder()).build()); } // ----- Endpoint: update_by_query_rethrottle /** * Throttle an update by query operation. *

* Change the number of requests per second for a particular update by query * operation. Rethrottling that speeds up the query takes effect immediately but * rethrotting that slows down the query takes effect after completing the * current batch to prevent scroll timeouts. * * @see Documentation * on elastic.co */ public UpdateByQueryRethrottleResponse updateByQueryRethrottle(UpdateByQueryRethrottleRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) UpdateByQueryRethrottleRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** * Throttle an update by query operation. *

* Change the number of requests per second for a particular update by query * operation. Rethrottling that speeds up the query takes effect immediately but * rethrotting that slows down the query takes effect after completing the * current batch to prevent scroll timeouts. * * @param fn * a function that initializes a builder to create the * {@link UpdateByQueryRethrottleRequest} * @see Documentation * on elastic.co */ public final UpdateByQueryRethrottleResponse updateByQueryRethrottle( Function> fn) throws IOException, ElasticsearchException { return updateByQueryRethrottle(fn.apply(new UpdateByQueryRethrottleRequest.Builder()).build()); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy