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

co.elastic.clients.elasticsearch.sql.ElasticsearchSqlAsyncClient 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.sql;

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.util.ObjectBuilder;
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 sql namespace.
 */
public class ElasticsearchSqlAsyncClient extends ApiClient {

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

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

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

	// ----- Endpoint: sql.clear_cursor

	/**
	 * Clear an SQL search cursor.
	 * 
	 * @see Documentation
	 *      on elastic.co
	 */

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

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

	/**
	 * Clear an SQL search cursor.
	 * 
	 * @param fn
	 *            a function that initializes a builder to create the
	 *            {@link ClearCursorRequest}
	 * @see Documentation
	 *      on elastic.co
	 */

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

	// ----- Endpoint: sql.delete_async

	/**
	 * Delete an async SQL search. Delete an async SQL search or a stored
	 * synchronous SQL search. If the search is still running, the API cancels it.
	 * 

* If the Elasticsearch security features are enabled, only the following users * can use this API to delete a search: *

    *
  • Users with the cancel_task cluster privilege.
  • *
  • The user who first submitted the search.
  • *
* * @see Documentation * on elastic.co */ public CompletableFuture deleteAsync(DeleteAsyncRequest request) { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) DeleteAsyncRequest._ENDPOINT; return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** * Delete an async SQL search. Delete an async SQL search or a stored * synchronous SQL search. If the search is still running, the API cancels it. *

* If the Elasticsearch security features are enabled, only the following users * can use this API to delete a search: *

    *
  • Users with the cancel_task cluster privilege.
  • *
  • The user who first submitted the search.
  • *
* * @param fn * a function that initializes a builder to create the * {@link DeleteAsyncRequest} * @see Documentation * on elastic.co */ public final CompletableFuture deleteAsync( Function> fn) { return deleteAsync(fn.apply(new DeleteAsyncRequest.Builder()).build()); } // ----- Endpoint: sql.get_async /** * Get async SQL search results. Get the current status and available results * for an async SQL search or stored synchronous SQL search. *

* If the Elasticsearch security features are enabled, only the user who first * submitted the SQL search can retrieve the search using this API. * * @see Documentation * on elastic.co */ public CompletableFuture getAsync(GetAsyncRequest request) { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) GetAsyncRequest._ENDPOINT; return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** * Get async SQL search results. Get the current status and available results * for an async SQL search or stored synchronous SQL search. *

* If the Elasticsearch security features are enabled, only the user who first * submitted the SQL search can retrieve the search using this API. * * @param fn * a function that initializes a builder to create the * {@link GetAsyncRequest} * @see Documentation * on elastic.co */ public final CompletableFuture getAsync( Function> fn) { return getAsync(fn.apply(new GetAsyncRequest.Builder()).build()); } // ----- Endpoint: sql.get_async_status /** * Get the async SQL search status. Get the current status of an async SQL * search or a stored synchronous SQL search. * * @see Documentation * on elastic.co */ public CompletableFuture getAsyncStatus(GetAsyncStatusRequest request) { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) GetAsyncStatusRequest._ENDPOINT; return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** * Get the async SQL search status. Get the current status of an async SQL * search or a stored synchronous SQL search. * * @param fn * a function that initializes a builder to create the * {@link GetAsyncStatusRequest} * @see Documentation * on elastic.co */ public final CompletableFuture getAsyncStatus( Function> fn) { return getAsyncStatus(fn.apply(new GetAsyncStatusRequest.Builder()).build()); } // ----- Endpoint: sql.query /** * Get SQL search results. Run an SQL request. * * @see Documentation * on elastic.co */ public CompletableFuture query(QueryRequest request) { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) QueryRequest._ENDPOINT; return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** * Get SQL search results. Run an SQL request. * * @param fn * a function that initializes a builder to create the * {@link QueryRequest} * @see Documentation * on elastic.co */ public final CompletableFuture query( Function> fn) { return query(fn.apply(new QueryRequest.Builder()).build()); } /** * Get SQL search results. Run an SQL request. * * @see Documentation * on elastic.co */ public CompletableFuture query() { return this.transport.performRequestAsync(new QueryRequest.Builder().build(), QueryRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: sql.translate /** * Translate SQL into Elasticsearch queries. Translate an SQL search into a * search API request containing Query DSL. It accepts the same request body * parameters as the SQL search API, excluding cursor. * * @see Documentation * on elastic.co */ public CompletableFuture translate(TranslateRequest request) { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint) TranslateRequest._ENDPOINT; return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** * Translate SQL into Elasticsearch queries. Translate an SQL search into a * search API request containing Query DSL. It accepts the same request body * parameters as the SQL search API, excluding cursor. * * @param fn * a function that initializes a builder to create the * {@link TranslateRequest} * @see Documentation * on elastic.co */ public final CompletableFuture translate( Function> fn) { return translate(fn.apply(new TranslateRequest.Builder()).build()); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy