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

co.elastic.clients.elasticsearch.async_search.ElasticsearchAsyncSearchAsyncClient Maven / Gradle / Ivy

The newest version!
/*
 * 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.async_search;

import co.elastic.clients.ApiClient;
import co.elastic.clients.elasticsearch._types.ErrorResponse;
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.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 async_search namespace.
 */
public class ElasticsearchAsyncSearchAsyncClient
		extends
			ApiClient {

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

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

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

	// ----- Endpoint: async_search.delete

	/**
	 * Delete an async search.
	 * 

* If the asynchronous search is still running, it is cancelled. Otherwise, the * saved search results are deleted. If the Elasticsearch security features are * enabled, the deletion of a specific async search is restricted to: the * authenticated user that submitted the original search request; users that * have the cancel_task cluster privilege. * * @see Documentation * on elastic.co */ public CompletableFuture delete(DeleteAsyncSearchRequest request) { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) DeleteAsyncSearchRequest._ENDPOINT; return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** * Delete an async search. *

* If the asynchronous search is still running, it is cancelled. Otherwise, the * saved search results are deleted. If the Elasticsearch security features are * enabled, the deletion of a specific async search is restricted to: the * authenticated user that submitted the original search request; users that * have the cancel_task cluster privilege. * * @param fn * a function that initializes a builder to create the * {@link DeleteAsyncSearchRequest} * @see Documentation * on elastic.co */ public final CompletableFuture delete( Function> fn) { return delete(fn.apply(new DeleteAsyncSearchRequest.Builder()).build()); } // ----- Endpoint: async_search.get /** * Get async search results. *

* Retrieve the results of a previously submitted asynchronous search request. * If the Elasticsearch security features are enabled, access to the results of * a specific async search is restricted to the user or API key that submitted * it. * * @see Documentation * on elastic.co */ public CompletableFuture> get(GetAsyncSearchRequest request, Class tDocumentClass) { @SuppressWarnings("unchecked") JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetAsyncSearchRequest._ENDPOINT; endpoint = new EndpointWithResponseMapperAttr<>(endpoint, "co.elastic.clients:Deserializer:async_search.get.Response.TDocument", getDeserializer(tDocumentClass)); return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** * Get async search results. *

* Retrieve the results of a previously submitted asynchronous search request. * If the Elasticsearch security features are enabled, access to the results of * a specific async search is restricted to the user or API key that submitted * it. * * @param fn * a function that initializes a builder to create the * {@link GetAsyncSearchRequest} * @see Documentation * on elastic.co */ public final CompletableFuture> get( Function> fn, Class tDocumentClass) { return get(fn.apply(new GetAsyncSearchRequest.Builder()).build(), tDocumentClass); } /** * Get async search results. *

* Retrieve the results of a previously submitted asynchronous search request. * If the Elasticsearch security features are enabled, access to the results of * a specific async search is restricted to the user or API key that submitted * it. * * @see Documentation * on elastic.co */ public CompletableFuture> get(GetAsyncSearchRequest request, Type tDocumentType) { @SuppressWarnings("unchecked") JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) GetAsyncSearchRequest._ENDPOINT; endpoint = new EndpointWithResponseMapperAttr<>(endpoint, "co.elastic.clients:Deserializer:async_search.get.Response.TDocument", getDeserializer(tDocumentType)); return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** * Get async search results. *

* Retrieve the results of a previously submitted asynchronous search request. * If the Elasticsearch security features are enabled, access to the results of * a specific async search is restricted to the user or API key that submitted * it. * * @param fn * a function that initializes a builder to create the * {@link GetAsyncSearchRequest} * @see Documentation * on elastic.co */ public final CompletableFuture> get( Function> fn, Type tDocumentType) { return get(fn.apply(new GetAsyncSearchRequest.Builder()).build(), tDocumentType); } // ----- Endpoint: async_search.status /** * Get the async search status. *

* Get the status of a previously submitted async search request given its * identifier, without retrieving search results. If the Elasticsearch security * features are enabled, use of this API is restricted to the * monitoring_user role. * * @see Documentation * on elastic.co */ public CompletableFuture status(AsyncSearchStatusRequest request) { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) AsyncSearchStatusRequest._ENDPOINT; return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** * Get the async search status. *

* Get the status of a previously submitted async search request given its * identifier, without retrieving search results. If the Elasticsearch security * features are enabled, use of this API is restricted to the * monitoring_user role. * * @param fn * a function that initializes a builder to create the * {@link AsyncSearchStatusRequest} * @see Documentation * on elastic.co */ public final CompletableFuture status( Function> fn) { return status(fn.apply(new AsyncSearchStatusRequest.Builder()).build()); } // ----- Endpoint: async_search.submit /** * Run an async search. *

* When the primary sort of the results is an indexed field, shards get sorted * based on minimum and maximum value that they hold for that field. Partial * results become available following the sort criteria that was requested. *

* Warning: Asynchronous search does not support scroll or search requests that * include only the suggest section. *

* By default, Elasticsearch does not allow you to store an async search * response larger than 10Mb and an attempt to do this results in an error. The * maximum allowed size for a stored async search response can be set by * changing the search.max_async_search_response_size cluster level * setting. * * @see Documentation * on elastic.co */ public CompletableFuture> submit(SubmitRequest request, Class tDocumentClass) { @SuppressWarnings("unchecked") JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SubmitRequest._ENDPOINT; endpoint = new EndpointWithResponseMapperAttr<>(endpoint, "co.elastic.clients:Deserializer:async_search.submit.Response.TDocument", getDeserializer(tDocumentClass)); return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** * Run an async search. *

* When the primary sort of the results is an indexed field, shards get sorted * based on minimum and maximum value that they hold for that field. Partial * results become available following the sort criteria that was requested. *

* Warning: Asynchronous search does not support scroll or search requests that * include only the suggest section. *

* By default, Elasticsearch does not allow you to store an async search * response larger than 10Mb and an attempt to do this results in an error. The * maximum allowed size for a stored async search response can be set by * changing the search.max_async_search_response_size cluster level * setting. * * @param fn * a function that initializes a builder to create the * {@link SubmitRequest} * @see Documentation * on elastic.co */ public final CompletableFuture> submit( Function> fn, Class tDocumentClass) { return submit(fn.apply(new SubmitRequest.Builder()).build(), tDocumentClass); } /** * Run an async search. *

* When the primary sort of the results is an indexed field, shards get sorted * based on minimum and maximum value that they hold for that field. Partial * results become available following the sort criteria that was requested. *

* Warning: Asynchronous search does not support scroll or search requests that * include only the suggest section. *

* By default, Elasticsearch does not allow you to store an async search * response larger than 10Mb and an attempt to do this results in an error. The * maximum allowed size for a stored async search response can be set by * changing the search.max_async_search_response_size cluster level * setting. * * @see Documentation * on elastic.co */ public CompletableFuture> submit(SubmitRequest request, Type tDocumentType) { @SuppressWarnings("unchecked") JsonEndpoint, ErrorResponse> endpoint = (JsonEndpoint, ErrorResponse>) SubmitRequest._ENDPOINT; endpoint = new EndpointWithResponseMapperAttr<>(endpoint, "co.elastic.clients:Deserializer:async_search.submit.Response.TDocument", getDeserializer(tDocumentType)); return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** * Run an async search. *

* When the primary sort of the results is an indexed field, shards get sorted * based on minimum and maximum value that they hold for that field. Partial * results become available following the sort criteria that was requested. *

* Warning: Asynchronous search does not support scroll or search requests that * include only the suggest section. *

* By default, Elasticsearch does not allow you to store an async search * response larger than 10Mb and an attempt to do this results in an error. The * maximum allowed size for a stored async search response can be set by * changing the search.max_async_search_response_size cluster level * setting. * * @param fn * a function that initializes a builder to create the * {@link SubmitRequest} * @see Documentation * on elastic.co */ public final CompletableFuture> submit( Function> fn, Type tDocumentType) { return submit(fn.apply(new SubmitRequest.Builder()).build(), tDocumentType); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy