co.elastic.clients.elasticsearch.sql.ElasticsearchSqlAsyncClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elasticsearch-java Show documentation
Show all versions of elasticsearch-java Show documentation
Elasticsearch Java API Client
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------
package co.elastic.clients.elasticsearch.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;
/**
* 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
/**
* Clears the SQL 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);
}
/**
* Clears the SQL 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
/**
* Deletes an async SQL search or a stored synchronous SQL search. If the search
* is still running, the API cancels it.
*
* @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);
}
/**
* Deletes an async SQL search or a stored synchronous SQL search. If the search
* is still running, the API cancels it.
*
* @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
/**
* Returns the current status and available results for an async SQL search or
* stored synchronous SQL search
*
* @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);
}
/**
* Returns the current status and available results for an async SQL search or
* stored synchronous SQL search
*
* @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
/**
* Returns 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);
}
/**
* Returns 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
/**
* Executes a 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);
}
/**
* Executes a 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());
}
/**
* Executes a 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
/**
* Translates SQL into Elasticsearch queries
*
* @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);
}
/**
* Translates SQL into Elasticsearch queries
*
* @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