co.elastic.clients.elasticsearch.sql.ElasticsearchSqlClient 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.ElasticsearchException;
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.io.IOException;
import java.util.function.Function;
import javax.annotation.Nullable;
/**
* Client for the sql namespace.
*/
public class ElasticsearchSqlClient extends ApiClient {
public ElasticsearchSqlClient(ElasticsearchTransport transport) {
super(transport, null);
}
public ElasticsearchSqlClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions) {
super(transport, transportOptions);
}
@Override
public ElasticsearchSqlClient withTransportOptions(@Nullable TransportOptions transportOptions) {
return new ElasticsearchSqlClient(this.transport, transportOptions);
}
// ----- Endpoint: sql.clear_cursor
/**
* Clears the SQL cursor
*
* @see Documentation
* on elastic.co
*/
public ClearCursorResponse clearCursor(ClearCursorRequest request) throws IOException, ElasticsearchException {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) ClearCursorRequest._ENDPOINT;
return this.transport.performRequest(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 ClearCursorResponse clearCursor(
Function> fn)
throws IOException, ElasticsearchException {
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 DeleteAsyncResponse deleteAsync(DeleteAsyncRequest request) throws IOException, ElasticsearchException {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) DeleteAsyncRequest._ENDPOINT;
return this.transport.performRequest(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 DeleteAsyncResponse deleteAsync(
Function> fn)
throws IOException, ElasticsearchException {
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 GetAsyncResponse getAsync(GetAsyncRequest request) throws IOException, ElasticsearchException {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) GetAsyncRequest._ENDPOINT;
return this.transport.performRequest(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 GetAsyncResponse getAsync(Function> fn)
throws IOException, ElasticsearchException {
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 GetAsyncStatusResponse getAsyncStatus(GetAsyncStatusRequest request)
throws IOException, ElasticsearchException {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) GetAsyncStatusRequest._ENDPOINT;
return this.transport.performRequest(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 GetAsyncStatusResponse getAsyncStatus(
Function> fn)
throws IOException, ElasticsearchException {
return getAsyncStatus(fn.apply(new GetAsyncStatusRequest.Builder()).build());
}
// ----- Endpoint: sql.query
/**
* Executes a SQL request
*
* @see Documentation
* on elastic.co
*/
public QueryResponse query(QueryRequest request) throws IOException, ElasticsearchException {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) QueryRequest._ENDPOINT;
return this.transport.performRequest(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 QueryResponse query(Function> fn)
throws IOException, ElasticsearchException {
return query(fn.apply(new QueryRequest.Builder()).build());
}
/**
* Executes a SQL request
*
* @see Documentation
* on elastic.co
*/
public QueryResponse query() throws IOException, ElasticsearchException {
return this.transport.performRequest(new QueryRequest.Builder().build(), QueryRequest._ENDPOINT,
this.transportOptions);
}
// ----- Endpoint: sql.translate
/**
* Translates SQL into Elasticsearch queries
*
* @see Documentation
* on elastic.co
*/
public TranslateResponse translate(TranslateRequest request) throws IOException, ElasticsearchException {
@SuppressWarnings("unchecked")
JsonEndpoint endpoint = (JsonEndpoint) TranslateRequest._ENDPOINT;
return this.transport.performRequest(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 TranslateResponse translate(Function> fn)
throws IOException, ElasticsearchException {
return translate(fn.apply(new TranslateRequest.Builder()).build());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy