Class RestHighLevelClient
- java.lang.Object
-
- org.opensearch.client.RestHighLevelClient
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class RestHighLevelClient extends java.lang.Object implements java.io.CloseableHigh level REST client that wraps an instance of the low levelRestClientand allows to build requests and read responses. TheRestClientinstance is internally built based on the providedRestClientBuilderand it gets closed automatically when closing theRestHighLevelClientinstance that wraps it.In case an already existing instance of a low-level REST client needs to be provided, this class can be subclassed and the
RestHighLevelClient(RestClient, CheckedConsumer, List)constructor can be used.This class can also be sub-classed to expose additional client methods that make use of endpoints added to OpenSearch through plugins, or to add support for custom response sections, again added to OpenSearch through plugins.
The majority of the methods in this class come in two flavors, a blocking and an asynchronous version (e.g.
search(SearchRequest, RequestOptions)andsearchAsync(SearchRequest, RequestOptions, ActionListener), where the later takes an implementation of anActionListeneras an argument that needs to implement methods that handle successful responses and failure scenarios. Most of the blocking calls can throw anIOExceptionor an uncheckedOpenSearchExceptionin the following cases:- an
IOExceptionis usually thrown in case of failing to parse the REST response in the high-level REST client, the request times out or similar cases where there is no response coming back from the OpenSearch server - an
OpenSearchExceptionis usually thrown in case where the server returns a 4xx or 5xx error code. The high-level client then tries to parse the response body error details into a generic OpenSearchException and suppresses the originalResponseException
-
-
Constructor Summary
Constructors Modifier Constructor Description RestHighLevelClient(org.opensearch.client.RestClientBuilder restClientBuilder)Creates aRestHighLevelClientgiven the low levelRestClientBuilderthat allows to build theRestClientto be used to perform requests.protectedRestHighLevelClient(org.opensearch.client.RestClientBuilder restClientBuilder, java.util.List<org.opensearch.common.xcontent.NamedXContentRegistry.Entry> namedXContentEntries)Creates aRestHighLevelClientgiven the low levelRestClientBuilderthat allows to build theRestClientto be used to perform requests and parsers for custom response sections added to OpenSearch through plugins.protectedRestHighLevelClient(org.opensearch.client.RestClient restClient, org.opensearch.common.CheckedConsumer<org.opensearch.client.RestClient,java.io.IOException> doClose, java.util.List<org.opensearch.common.xcontent.NamedXContentRegistry.Entry> namedXContentEntries)Creates aRestHighLevelClientgiven the low levelRestClientthat it should use to perform requests and a list of entries that allow to parse custom response sections added to OpenSearch through plugins.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.opensearch.action.bulk.BulkResponsebulk(org.opensearch.action.bulk.BulkRequest bulkRequest, org.opensearch.client.RequestOptions options)Executes a bulk request using the Bulk API.org.opensearch.client.CancellablebulkAsync(org.opensearch.action.bulk.BulkRequest bulkRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.bulk.BulkResponse> listener)Asynchronously executes a bulk request using the Bulk API.org.opensearch.action.search.ClearScrollResponseclearScroll(org.opensearch.action.search.ClearScrollRequest clearScrollRequest, org.opensearch.client.RequestOptions options)Clears one or more scroll ids using the Clear Scroll API.org.opensearch.client.CancellableclearScrollAsync(org.opensearch.action.search.ClearScrollRequest clearScrollRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.search.ClearScrollResponse> listener)Asynchronously clears one or more scroll ids using the Clear Scroll API.voidclose()ClusterClientcluster()Provides aClusterClientwhich can be used to access the Cluster API.protected static booleanconvertExistsResponse(org.opensearch.client.Response response)CountResponsecount(CountRequest countRequest, org.opensearch.client.RequestOptions options)Executes a count request using the Count API.org.opensearch.client.CancellablecountAsync(CountRequest countRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<CountResponse> listener)Asynchronously executes a count request using the Count API.org.opensearch.action.delete.DeleteResponsedelete(org.opensearch.action.delete.DeleteRequest deleteRequest, org.opensearch.client.RequestOptions options)Deletes a document by id using the Delete API.org.opensearch.client.CancellabledeleteAsync(org.opensearch.action.delete.DeleteRequest deleteRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.delete.DeleteResponse> listener)Asynchronously deletes a document by id using the Delete API.org.opensearch.index.reindex.BulkByScrollResponsedeleteByQuery(org.opensearch.index.reindex.DeleteByQueryRequest deleteByQueryRequest, org.opensearch.client.RequestOptions options)Executes a delete by query request.org.opensearch.client.CancellabledeleteByQueryAsync(org.opensearch.index.reindex.DeleteByQueryRequest deleteByQueryRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.index.reindex.BulkByScrollResponse> listener)Asynchronously executes a delete by query request.org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponsedeleteByQueryRethrottle(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options)Executes a delete by query rethrottle request.org.opensearch.client.CancellabledeleteByQueryRethrottleAsync(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse> listener)Asynchronously execute an delete by query rethrottle request.org.opensearch.action.support.master.AcknowledgedResponsedeleteScript(org.opensearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest request, org.opensearch.client.RequestOptions options)Delete stored script by id.org.opensearch.client.CancellabledeleteScriptAsync(org.opensearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest request, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.support.master.AcknowledgedResponse> listener)Asynchronously delete stored script by id.booleanexists(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options)Checks for the existence of a document.org.opensearch.client.CancellableexistsAsync(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<java.lang.Boolean> listener)Asynchronously checks for the existence of a document.booleanexistsSource(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options)Deprecated.useexistsSource(GetSourceRequest, RequestOptions)insteadbooleanexistsSource(GetSourceRequest getSourceRequest, org.opensearch.client.RequestOptions options)Checks for the existence of a document with a "_source" field.org.opensearch.client.CancellableexistsSourceAsync(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<java.lang.Boolean> listener)Deprecated.org.opensearch.client.CancellableexistsSourceAsync(GetSourceRequest getSourceRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<java.lang.Boolean> listener)Asynchronously checks for the existence of a document with a "_source" field.org.opensearch.action.explain.ExplainResponseexplain(org.opensearch.action.explain.ExplainRequest explainRequest, org.opensearch.client.RequestOptions options)Executes a request using the Explain API.org.opensearch.client.CancellableexplainAsync(org.opensearch.action.explain.ExplainRequest explainRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.explain.ExplainResponse> listener)Asynchronously executes a request using the Explain API.org.opensearch.action.fieldcaps.FieldCapabilitiesResponsefieldCaps(org.opensearch.action.fieldcaps.FieldCapabilitiesRequest fieldCapabilitiesRequest, org.opensearch.client.RequestOptions options)Executes a request using the Field Capabilities API.org.opensearch.client.CancellablefieldCapsAsync(org.opensearch.action.fieldcaps.FieldCapabilitiesRequest fieldCapabilitiesRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.fieldcaps.FieldCapabilitiesResponse> listener)Asynchronously executes a request using the Field Capabilities API.org.opensearch.action.get.GetResponseget(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options)Retrieves a document by id using the Get API.org.opensearch.client.CancellablegetAsync(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.get.GetResponse> listener)Asynchronously retrieves a document by id using the Get API.org.opensearch.client.RestClientgetLowLevelClient()Returns the low-level client that the current high-level client instance is using to perform requestsorg.opensearch.action.admin.cluster.storedscripts.GetStoredScriptResponsegetScript(org.opensearch.action.admin.cluster.storedscripts.GetStoredScriptRequest request, org.opensearch.client.RequestOptions options)Get stored script by id.org.opensearch.client.CancellablegetScriptAsync(org.opensearch.action.admin.cluster.storedscripts.GetStoredScriptRequest request, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.admin.cluster.storedscripts.GetStoredScriptResponse> listener)Asynchronously get stored script by id.GetSourceResponsegetSource(GetSourceRequest getSourceRequest, org.opensearch.client.RequestOptions options)Retrieves the source field only of a document using GetSource API.org.opensearch.client.CancellablegetSourceAsync(GetSourceRequest getSourceRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<GetSourceResponse> listener)Asynchronously retrieves the source field only of a document using GetSource API.org.opensearch.action.index.IndexResponseindex(org.opensearch.action.index.IndexRequest indexRequest, org.opensearch.client.RequestOptions options)Index a document using the Index API.org.opensearch.client.CancellableindexAsync(org.opensearch.action.index.IndexRequest indexRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.index.IndexResponse> listener)Asynchronously index a document using the Index API.IndicesClientindices()Provides anIndicesClientwhich can be used to access the Indices API.MainResponseinfo(org.opensearch.client.RequestOptions options)Get the cluster info otherwise provided when sending an HTTP request to '/'IngestClientingest()Provides aIngestClientwhich can be used to access the Ingest API.org.opensearch.action.get.MultiGetResponsemget(org.opensearch.action.get.MultiGetRequest multiGetRequest, org.opensearch.client.RequestOptions options)Retrieves multiple documents by id using the Multi Get API.org.opensearch.client.CancellablemgetAsync(org.opensearch.action.get.MultiGetRequest multiGetRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.get.MultiGetResponse> listener)Asynchronously retrieves multiple documents by id using the Multi Get API.org.opensearch.action.search.MultiSearchResponsemsearch(org.opensearch.action.search.MultiSearchRequest multiSearchRequest, org.opensearch.client.RequestOptions options)Executes a multi search using the msearch API.org.opensearch.client.CancellablemsearchAsync(org.opensearch.action.search.MultiSearchRequest searchRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.search.MultiSearchResponse> listener)Asynchronously executes a multi search using the msearch API.org.opensearch.script.mustache.MultiSearchTemplateResponsemsearchTemplate(org.opensearch.script.mustache.MultiSearchTemplateRequest multiSearchTemplateRequest, org.opensearch.client.RequestOptions options)Executes a request using the Multi Search Template API.org.opensearch.client.CancellablemsearchTemplateAsync(org.opensearch.script.mustache.MultiSearchTemplateRequest multiSearchTemplateRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.script.mustache.MultiSearchTemplateResponse> listener)Asynchronously executes a request using the Multi Search Template APIMultiTermVectorsResponsemtermvectors(MultiTermVectorsRequest request, org.opensearch.client.RequestOptions options)Calls the Multi Term Vectors APIorg.opensearch.client.CancellablemtermvectorsAsync(MultiTermVectorsRequest request, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<MultiTermVectorsResponse> listener)Asynchronously calls the Multi Term Vectors APIorg.opensearch.action.get.MultiGetResponsemultiGet(org.opensearch.action.get.MultiGetRequest multiGetRequest, org.opensearch.client.RequestOptions options)Deprecated.usemget(MultiGetRequest, RequestOptions)insteadorg.opensearch.client.CancellablemultiGetAsync(org.opensearch.action.get.MultiGetRequest multiGetRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.get.MultiGetResponse> listener)Deprecated.org.opensearch.action.search.MultiSearchResponsemultiSearch(org.opensearch.action.search.MultiSearchRequest multiSearchRequest, org.opensearch.client.RequestOptions options)Deprecated.usemsearch(MultiSearchRequest, RequestOptions)insteadorg.opensearch.client.CancellablemultiSearchAsync(org.opensearch.action.search.MultiSearchRequest searchRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.search.MultiSearchResponse> listener)Deprecated.protected <Resp> RespparseEntity(org.apache.http.HttpEntity entity, org.opensearch.common.CheckedFunction<org.opensearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser)protected org.opensearch.OpenSearchStatusExceptionparseResponseException(org.opensearch.client.ResponseException responseException)Converts aResponseExceptionobtained from the low level REST client into anOpenSearchException.protected <Req extends org.opensearch.action.ActionRequest,Resp>
RespperformRequest(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.client.Response,Resp,java.io.IOException> responseConverter, java.util.Set<java.lang.Integer> ignores)Deprecated.If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions.protected <Req extends org.opensearch.action.ActionRequest,Resp>
RespperformRequestAndParseEntity(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser, java.util.Set<java.lang.Integer> ignores)Deprecated.If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions.protected <Req extends Validatable,Resp>
java.util.Optional<Resp>performRequestAndParseOptionalEntity(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser)Defines a helper method for requests that can 404 and in which case will return an empty Optional otherwise tries to parse the response bodyprotected <Req extends org.opensearch.action.ActionRequest,Resp>
org.opensearch.client.CancellableperformRequestAsync(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.client.Response,Resp,java.io.IOException> responseConverter, org.opensearch.action.ActionListener<Resp> listener, java.util.Set<java.lang.Integer> ignores)Deprecated.If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions.protected <Req extends org.opensearch.action.ActionRequest,Resp>
org.opensearch.client.CancellableperformRequestAsyncAndParseEntity(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser, org.opensearch.action.ActionListener<Resp> listener, java.util.Set<java.lang.Integer> ignores)Deprecated.If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions.protected <Req extends Validatable,Resp>
org.opensearch.client.CancellableperformRequestAsyncAndParseOptionalEntity(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser, org.opensearch.action.ActionListener<java.util.Optional<Resp>> listener)Asynchronous request which returns emptyOptionals in the case of 404s or parses entity into an Optionalbooleanping(org.opensearch.client.RequestOptions options)Pings the remote OpenSearch cluster and returns true if the ping succeeded, false otherwiseorg.opensearch.action.support.master.AcknowledgedResponseputScript(org.opensearch.action.admin.cluster.storedscripts.PutStoredScriptRequest putStoredScriptRequest, org.opensearch.client.RequestOptions options)Puts an stored script using the Scripting API.org.opensearch.client.CancellableputScriptAsync(org.opensearch.action.admin.cluster.storedscripts.PutStoredScriptRequest putStoredScriptRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.support.master.AcknowledgedResponse> listener)Asynchronously puts an stored script using the Scripting API.org.opensearch.index.rankeval.RankEvalResponserankEval(org.opensearch.index.rankeval.RankEvalRequest rankEvalRequest, org.opensearch.client.RequestOptions options)Executes a request using the Ranking Evaluation API.org.opensearch.client.CancellablerankEvalAsync(org.opensearch.index.rankeval.RankEvalRequest rankEvalRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.index.rankeval.RankEvalResponse> listener)Asynchronously executes a request using the Ranking Evaluation API.org.opensearch.index.reindex.BulkByScrollResponsereindex(org.opensearch.index.reindex.ReindexRequest reindexRequest, org.opensearch.client.RequestOptions options)Executes a reindex request.org.opensearch.client.CancellablereindexAsync(org.opensearch.index.reindex.ReindexRequest reindexRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.index.reindex.BulkByScrollResponse> listener)Asynchronously executes a reindex request.org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponsereindexRethrottle(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options)Executes a reindex rethrottling request.org.opensearch.client.CancellablereindexRethrottleAsync(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse> listener)Executes a reindex rethrottling request.org.opensearch.action.search.SearchResponsescroll(org.opensearch.action.search.SearchScrollRequest searchScrollRequest, org.opensearch.client.RequestOptions options)Executes a search using the Search Scroll API.org.opensearch.client.CancellablescrollAsync(org.opensearch.action.search.SearchScrollRequest searchScrollRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)Asynchronously executes a search using the Search Scroll API.org.opensearch.action.search.SearchResponsesearch(org.opensearch.action.search.SearchRequest searchRequest, org.opensearch.client.RequestOptions options)Executes a search request using the Search API.org.opensearch.client.CancellablesearchAsync(org.opensearch.action.search.SearchRequest searchRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)Asynchronously executes a search using the Search API.org.opensearch.action.search.SearchResponsesearchScroll(org.opensearch.action.search.SearchScrollRequest searchScrollRequest, org.opensearch.client.RequestOptions options)Deprecated.usescroll(SearchScrollRequest, RequestOptions)insteadorg.opensearch.client.CancellablesearchScrollAsync(org.opensearch.action.search.SearchScrollRequest searchScrollRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)Deprecated.org.opensearch.script.mustache.SearchTemplateResponsesearchTemplate(org.opensearch.script.mustache.SearchTemplateRequest searchTemplateRequest, org.opensearch.client.RequestOptions options)Executes a request using the Search Template API.org.opensearch.client.CancellablesearchTemplateAsync(org.opensearch.script.mustache.SearchTemplateRequest searchTemplateRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.script.mustache.SearchTemplateResponse> listener)Asynchronously executes a request using the Search Template API.SnapshotClientsnapshot()Provides aSnapshotClientwhich can be used to access the Snapshot API.TaskSubmissionResponsesubmitDeleteByQueryTask(org.opensearch.index.reindex.DeleteByQueryRequest deleteByQueryRequest, org.opensearch.client.RequestOptions options)Submits a delete by query taskTaskSubmissionResponsesubmitReindexTask(org.opensearch.index.reindex.ReindexRequest reindexRequest, org.opensearch.client.RequestOptions options)Submits a reindex task.TaskSubmissionResponsesubmitUpdateByQueryTask(org.opensearch.index.reindex.UpdateByQueryRequest updateByQueryRequest, org.opensearch.client.RequestOptions options)Submits a update by query task.TasksClienttasks()Provides aTasksClientwhich can be used to access the Tasks API.TermVectorsResponsetermvectors(TermVectorsRequest request, org.opensearch.client.RequestOptions options)Calls the Term Vectors APIorg.opensearch.client.CancellabletermvectorsAsync(TermVectorsRequest request, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<TermVectorsResponse> listener)Asynchronously calls the Term Vectors APIorg.opensearch.action.update.UpdateResponseupdate(org.opensearch.action.update.UpdateRequest updateRequest, org.opensearch.client.RequestOptions options)Updates a document using the Update API.org.opensearch.client.CancellableupdateAsync(org.opensearch.action.update.UpdateRequest updateRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.update.UpdateResponse> listener)Asynchronously updates a document using the Update API.org.opensearch.index.reindex.BulkByScrollResponseupdateByQuery(org.opensearch.index.reindex.UpdateByQueryRequest updateByQueryRequest, org.opensearch.client.RequestOptions options)Executes a update by query request.org.opensearch.client.CancellableupdateByQueryAsync(org.opensearch.index.reindex.UpdateByQueryRequest updateByQueryRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.index.reindex.BulkByScrollResponse> listener)Asynchronously executes an update by query request.org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponseupdateByQueryRethrottle(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options)Executes a update by query rethrottle request.org.opensearch.client.CancellableupdateByQueryRethrottleAsync(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse> listener)Asynchronously execute an update by query rethrottle request.
-
-
-
Constructor Detail
-
RestHighLevelClient
public RestHighLevelClient(org.opensearch.client.RestClientBuilder restClientBuilder)
Creates aRestHighLevelClientgiven the low levelRestClientBuilderthat allows to build theRestClientto be used to perform requests.
-
RestHighLevelClient
protected RestHighLevelClient(org.opensearch.client.RestClientBuilder restClientBuilder, java.util.List<org.opensearch.common.xcontent.NamedXContentRegistry.Entry> namedXContentEntries)Creates aRestHighLevelClientgiven the low levelRestClientBuilderthat allows to build theRestClientto be used to perform requests and parsers for custom response sections added to OpenSearch through plugins.
-
RestHighLevelClient
protected RestHighLevelClient(org.opensearch.client.RestClient restClient, org.opensearch.common.CheckedConsumer<org.opensearch.client.RestClient,java.io.IOException> doClose, java.util.List<org.opensearch.common.xcontent.NamedXContentRegistry.Entry> namedXContentEntries)Creates aRestHighLevelClientgiven the low levelRestClientthat it should use to perform requests and a list of entries that allow to parse custom response sections added to OpenSearch through plugins. This constructor can be called by subclasses in case an externally created low-level REST client needs to be provided. The consumer argument allows to control what needs to be done when theclose()method is called. Also subclasses can provide parsers for custom response sections added to OpenSearch through plugins.
-
-
Method Detail
-
getLowLevelClient
public final org.opensearch.client.RestClient getLowLevelClient()
Returns the low-level client that the current high-level client instance is using to perform requests
-
close
public final void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
indices
public final IndicesClient indices()
Provides anIndicesClientwhich can be used to access the Indices API.
-
cluster
public final ClusterClient cluster()
Provides aClusterClientwhich can be used to access the Cluster API.
-
ingest
public final IngestClient ingest()
Provides aIngestClientwhich can be used to access the Ingest API.
-
snapshot
public final SnapshotClient snapshot()
Provides aSnapshotClientwhich can be used to access the Snapshot API.
-
tasks
public final TasksClient tasks()
Provides aTasksClientwhich can be used to access the Tasks API.
-
bulk
public final org.opensearch.action.bulk.BulkResponse bulk(org.opensearch.action.bulk.BulkRequest bulkRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionExecutes a bulk request using the Bulk API.- Parameters:
bulkRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
bulkAsync
public final org.opensearch.client.Cancellable bulkAsync(org.opensearch.action.bulk.BulkRequest bulkRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.bulk.BulkResponse> listener)Asynchronously executes a bulk request using the Bulk API.- Parameters:
bulkRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
reindex
public final org.opensearch.index.reindex.BulkByScrollResponse reindex(org.opensearch.index.reindex.ReindexRequest reindexRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionExecutes a reindex request.- Parameters:
reindexRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
submitReindexTask
public final TaskSubmissionResponse submitReindexTask(org.opensearch.index.reindex.ReindexRequest reindexRequest, org.opensearch.client.RequestOptions options) throws java.io.IOException
Submits a reindex task.- Parameters:
reindexRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the submission response
- Throws:
java.io.IOException
-
reindexAsync
public final org.opensearch.client.Cancellable reindexAsync(org.opensearch.index.reindex.ReindexRequest reindexRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.index.reindex.BulkByScrollResponse> listener)Asynchronously executes a reindex request.- Parameters:
reindexRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
updateByQuery
public final org.opensearch.index.reindex.BulkByScrollResponse updateByQuery(org.opensearch.index.reindex.UpdateByQueryRequest updateByQueryRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionExecutes a update by query request.- Parameters:
updateByQueryRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
submitUpdateByQueryTask
public final TaskSubmissionResponse submitUpdateByQueryTask(org.opensearch.index.reindex.UpdateByQueryRequest updateByQueryRequest, org.opensearch.client.RequestOptions options) throws java.io.IOException
Submits a update by query task.- Parameters:
updateByQueryRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the submission response
- Throws:
java.io.IOException
-
updateByQueryAsync
public final org.opensearch.client.Cancellable updateByQueryAsync(org.opensearch.index.reindex.UpdateByQueryRequest updateByQueryRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.index.reindex.BulkByScrollResponse> listener)Asynchronously executes an update by query request.- Parameters:
updateByQueryRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
deleteByQuery
public final org.opensearch.index.reindex.BulkByScrollResponse deleteByQuery(org.opensearch.index.reindex.DeleteByQueryRequest deleteByQueryRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionExecutes a delete by query request.- Parameters:
deleteByQueryRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
submitDeleteByQueryTask
public final TaskSubmissionResponse submitDeleteByQueryTask(org.opensearch.index.reindex.DeleteByQueryRequest deleteByQueryRequest, org.opensearch.client.RequestOptions options) throws java.io.IOException
Submits a delete by query task- Parameters:
deleteByQueryRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the submission response
- Throws:
java.io.IOException
-
deleteByQueryAsync
public final org.opensearch.client.Cancellable deleteByQueryAsync(org.opensearch.index.reindex.DeleteByQueryRequest deleteByQueryRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.index.reindex.BulkByScrollResponse> listener)Asynchronously executes a delete by query request.- Parameters:
deleteByQueryRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
deleteByQueryRethrottle
public final org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse deleteByQueryRethrottle(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options) throws java.io.IOException
Executes a delete by query rethrottle request.- Parameters:
rethrottleRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
deleteByQueryRethrottleAsync
public final org.opensearch.client.Cancellable deleteByQueryRethrottleAsync(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse> listener)
Asynchronously execute an delete by query rethrottle request.- Parameters:
rethrottleRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
updateByQueryRethrottle
public final org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse updateByQueryRethrottle(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options) throws java.io.IOException
Executes a update by query rethrottle request.- Parameters:
rethrottleRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
updateByQueryRethrottleAsync
public final org.opensearch.client.Cancellable updateByQueryRethrottleAsync(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse> listener)
Asynchronously execute an update by query rethrottle request.- Parameters:
rethrottleRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
reindexRethrottle
public final org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse reindexRethrottle(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options) throws java.io.IOException
Executes a reindex rethrottling request.- Parameters:
rethrottleRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
reindexRethrottleAsync
public final org.opensearch.client.Cancellable reindexRethrottleAsync(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse> listener)
Executes a reindex rethrottling request.- Parameters:
rethrottleRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
ping
public final boolean ping(org.opensearch.client.RequestOptions options) throws java.io.IOExceptionPings the remote OpenSearch cluster and returns true if the ping succeeded, false otherwise- Parameters:
options- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
trueif the ping succeeded, false otherwise- Throws:
java.io.IOException
-
info
public final MainResponse info(org.opensearch.client.RequestOptions options) throws java.io.IOException
Get the cluster info otherwise provided when sending an HTTP request to '/'- Parameters:
options- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
get
public final org.opensearch.action.get.GetResponse get(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionRetrieves a document by id using the Get API.- Parameters:
getRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
getAsync
public final org.opensearch.client.Cancellable getAsync(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.get.GetResponse> listener)Asynchronously retrieves a document by id using the Get API.- Parameters:
getRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
multiGet
@Deprecated public final org.opensearch.action.get.MultiGetResponse multiGet(org.opensearch.action.get.MultiGetRequest multiGetRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionDeprecated.usemget(MultiGetRequest, RequestOptions)insteadRetrieves multiple documents by id using the Multi Get API.- Parameters:
multiGetRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
mget
public final org.opensearch.action.get.MultiGetResponse mget(org.opensearch.action.get.MultiGetRequest multiGetRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionRetrieves multiple documents by id using the Multi Get API.- Parameters:
multiGetRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
multiGetAsync
@Deprecated public final org.opensearch.client.Cancellable multiGetAsync(org.opensearch.action.get.MultiGetRequest multiGetRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.get.MultiGetResponse> listener)Deprecated.Asynchronously retrieves multiple documents by id using the Multi Get API.- Parameters:
multiGetRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
mgetAsync
public final org.opensearch.client.Cancellable mgetAsync(org.opensearch.action.get.MultiGetRequest multiGetRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.get.MultiGetResponse> listener)Asynchronously retrieves multiple documents by id using the Multi Get API.- Parameters:
multiGetRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
exists
public final boolean exists(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionChecks for the existence of a document. Returns true if it exists, false otherwise.- Parameters:
getRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
trueif the document exists,falseotherwise- Throws:
java.io.IOException
-
existsAsync
public final org.opensearch.client.Cancellable existsAsync(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<java.lang.Boolean> listener)Asynchronously checks for the existence of a document. Returns true if it exists, false otherwise.- Parameters:
getRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
existsSource
@Deprecated public boolean existsSource(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionDeprecated.useexistsSource(GetSourceRequest, RequestOptions)insteadChecks for the existence of a document with a "_source" field. Returns true if it exists, false otherwise.- Parameters:
getRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
trueif the document and _source field exists,falseotherwise- Throws:
java.io.IOException
-
existsSourceAsync
@Deprecated public final org.opensearch.client.Cancellable existsSourceAsync(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<java.lang.Boolean> listener)Deprecated.Asynchronously checks for the existence of a document with a "_source" field. Returns true if it exists, false otherwise.- Parameters:
getRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
existsSource
public boolean existsSource(GetSourceRequest getSourceRequest, org.opensearch.client.RequestOptions options) throws java.io.IOException
Checks for the existence of a document with a "_source" field. Returns true if it exists, false otherwise.- Parameters:
getSourceRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
trueif the document and _source field exists,falseotherwise- Throws:
java.io.IOException
-
existsSourceAsync
public final org.opensearch.client.Cancellable existsSourceAsync(GetSourceRequest getSourceRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<java.lang.Boolean> listener)
Asynchronously checks for the existence of a document with a "_source" field. Returns true if it exists, false otherwise.- Parameters:
getSourceRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
getSource
public GetSourceResponse getSource(GetSourceRequest getSourceRequest, org.opensearch.client.RequestOptions options) throws java.io.IOException
Retrieves the source field only of a document using GetSource API.- Parameters:
getSourceRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
getSourceAsync
public final org.opensearch.client.Cancellable getSourceAsync(GetSourceRequest getSourceRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<GetSourceResponse> listener)
Asynchronously retrieves the source field only of a document using GetSource API.- Parameters:
getSourceRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
index
public final org.opensearch.action.index.IndexResponse index(org.opensearch.action.index.IndexRequest indexRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionIndex a document using the Index API.- Parameters:
indexRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
indexAsync
public final org.opensearch.client.Cancellable indexAsync(org.opensearch.action.index.IndexRequest indexRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.index.IndexResponse> listener)Asynchronously index a document using the Index API.- Parameters:
indexRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
count
public final CountResponse count(CountRequest countRequest, org.opensearch.client.RequestOptions options) throws java.io.IOException
Executes a count request using the Count API.- Parameters:
countRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
countAsync
public final org.opensearch.client.Cancellable countAsync(CountRequest countRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<CountResponse> listener)
Asynchronously executes a count request using the Count API.- Parameters:
countRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
update
public final org.opensearch.action.update.UpdateResponse update(org.opensearch.action.update.UpdateRequest updateRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionUpdates a document using the Update API.- Parameters:
updateRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
updateAsync
public final org.opensearch.client.Cancellable updateAsync(org.opensearch.action.update.UpdateRequest updateRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.update.UpdateResponse> listener)Asynchronously updates a document using the Update API.- Parameters:
updateRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
delete
public final org.opensearch.action.delete.DeleteResponse delete(org.opensearch.action.delete.DeleteRequest deleteRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionDeletes a document by id using the Delete API.- Parameters:
deleteRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
deleteAsync
public final org.opensearch.client.Cancellable deleteAsync(org.opensearch.action.delete.DeleteRequest deleteRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.delete.DeleteResponse> listener)Asynchronously deletes a document by id using the Delete API.- Parameters:
deleteRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
search
public final org.opensearch.action.search.SearchResponse search(org.opensearch.action.search.SearchRequest searchRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionExecutes a search request using the Search API.- Parameters:
searchRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
searchAsync
public final org.opensearch.client.Cancellable searchAsync(org.opensearch.action.search.SearchRequest searchRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)Asynchronously executes a search using the Search API.- Parameters:
searchRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
multiSearch
@Deprecated public final org.opensearch.action.search.MultiSearchResponse multiSearch(org.opensearch.action.search.MultiSearchRequest multiSearchRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionDeprecated.usemsearch(MultiSearchRequest, RequestOptions)insteadExecutes a multi search using the msearch API.- Parameters:
multiSearchRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
msearch
public final org.opensearch.action.search.MultiSearchResponse msearch(org.opensearch.action.search.MultiSearchRequest multiSearchRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionExecutes a multi search using the msearch API.- Parameters:
multiSearchRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
multiSearchAsync
@Deprecated public final org.opensearch.client.Cancellable multiSearchAsync(org.opensearch.action.search.MultiSearchRequest searchRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.search.MultiSearchResponse> listener)Deprecated.Asynchronously executes a multi search using the msearch API.- Parameters:
searchRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
msearchAsync
public final org.opensearch.client.Cancellable msearchAsync(org.opensearch.action.search.MultiSearchRequest searchRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.search.MultiSearchResponse> listener)Asynchronously executes a multi search using the msearch API.- Parameters:
searchRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
searchScroll
@Deprecated public final org.opensearch.action.search.SearchResponse searchScroll(org.opensearch.action.search.SearchScrollRequest searchScrollRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionDeprecated.usescroll(SearchScrollRequest, RequestOptions)insteadExecutes a search using the Search Scroll API.- Parameters:
searchScrollRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
scroll
public final org.opensearch.action.search.SearchResponse scroll(org.opensearch.action.search.SearchScrollRequest searchScrollRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionExecutes a search using the Search Scroll API.- Parameters:
searchScrollRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
searchScrollAsync
@Deprecated public final org.opensearch.client.Cancellable searchScrollAsync(org.opensearch.action.search.SearchScrollRequest searchScrollRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)Deprecated.Asynchronously executes a search using the Search Scroll API.- Parameters:
searchScrollRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
scrollAsync
public final org.opensearch.client.Cancellable scrollAsync(org.opensearch.action.search.SearchScrollRequest searchScrollRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.search.SearchResponse> listener)Asynchronously executes a search using the Search Scroll API.- Parameters:
searchScrollRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
clearScroll
public final org.opensearch.action.search.ClearScrollResponse clearScroll(org.opensearch.action.search.ClearScrollRequest clearScrollRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionClears one or more scroll ids using the Clear Scroll API.- Parameters:
clearScrollRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
clearScrollAsync
public final org.opensearch.client.Cancellable clearScrollAsync(org.opensearch.action.search.ClearScrollRequest clearScrollRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.search.ClearScrollResponse> listener)Asynchronously clears one or more scroll ids using the Clear Scroll API.- Parameters:
clearScrollRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
searchTemplate
public final org.opensearch.script.mustache.SearchTemplateResponse searchTemplate(org.opensearch.script.mustache.SearchTemplateRequest searchTemplateRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionExecutes a request using the Search Template API.- Parameters:
searchTemplateRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
searchTemplateAsync
public final org.opensearch.client.Cancellable searchTemplateAsync(org.opensearch.script.mustache.SearchTemplateRequest searchTemplateRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.script.mustache.SearchTemplateResponse> listener)Asynchronously executes a request using the Search Template API.- Returns:
- cancellable that may be used to cancel the request
-
explain
public final org.opensearch.action.explain.ExplainResponse explain(org.opensearch.action.explain.ExplainRequest explainRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionExecutes a request using the Explain API.- Parameters:
explainRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
explainAsync
public final org.opensearch.client.Cancellable explainAsync(org.opensearch.action.explain.ExplainRequest explainRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.explain.ExplainResponse> listener)Asynchronously executes a request using the Explain API.- Parameters:
explainRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
termvectors
public final TermVectorsResponse termvectors(TermVectorsRequest request, org.opensearch.client.RequestOptions options) throws java.io.IOException
Calls the Term Vectors API- Parameters:
request- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Throws:
java.io.IOException
-
termvectorsAsync
public final org.opensearch.client.Cancellable termvectorsAsync(TermVectorsRequest request, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<TermVectorsResponse> listener)
Asynchronously calls the Term Vectors API- Parameters:
request- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
mtermvectors
public final MultiTermVectorsResponse mtermvectors(MultiTermVectorsRequest request, org.opensearch.client.RequestOptions options) throws java.io.IOException
Calls the Multi Term Vectors API- Parameters:
request- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Throws:
java.io.IOException
-
mtermvectorsAsync
public final org.opensearch.client.Cancellable mtermvectorsAsync(MultiTermVectorsRequest request, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<MultiTermVectorsResponse> listener)
Asynchronously calls the Multi Term Vectors API- Parameters:
request- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
rankEval
public final org.opensearch.index.rankeval.RankEvalResponse rankEval(org.opensearch.index.rankeval.RankEvalRequest rankEvalRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionExecutes a request using the Ranking Evaluation API.- Parameters:
rankEvalRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
msearchTemplate
public final org.opensearch.script.mustache.MultiSearchTemplateResponse msearchTemplate(org.opensearch.script.mustache.MultiSearchTemplateRequest multiSearchTemplateRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionExecutes a request using the Multi Search Template API.- Throws:
java.io.IOException
-
msearchTemplateAsync
public final org.opensearch.client.Cancellable msearchTemplateAsync(org.opensearch.script.mustache.MultiSearchTemplateRequest multiSearchTemplateRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.script.mustache.MultiSearchTemplateResponse> listener)Asynchronously executes a request using the Multi Search Template API- Returns:
- cancellable that may be used to cancel the request
-
rankEvalAsync
public final org.opensearch.client.Cancellable rankEvalAsync(org.opensearch.index.rankeval.RankEvalRequest rankEvalRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.index.rankeval.RankEvalResponse> listener)Asynchronously executes a request using the Ranking Evaluation API.- Parameters:
rankEvalRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
fieldCaps
public final org.opensearch.action.fieldcaps.FieldCapabilitiesResponse fieldCaps(org.opensearch.action.fieldcaps.FieldCapabilitiesRequest fieldCapabilitiesRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionExecutes a request using the Field Capabilities API.- Parameters:
fieldCapabilitiesRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
getScript
public org.opensearch.action.admin.cluster.storedscripts.GetStoredScriptResponse getScript(org.opensearch.action.admin.cluster.storedscripts.GetStoredScriptRequest request, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionGet stored script by id.- Parameters:
request- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
getScriptAsync
public org.opensearch.client.Cancellable getScriptAsync(org.opensearch.action.admin.cluster.storedscripts.GetStoredScriptRequest request, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.admin.cluster.storedscripts.GetStoredScriptResponse> listener)Asynchronously get stored script by id.- Parameters:
request- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
deleteScript
public org.opensearch.action.support.master.AcknowledgedResponse deleteScript(org.opensearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest request, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionDelete stored script by id.- Parameters:
request- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
deleteScriptAsync
public org.opensearch.client.Cancellable deleteScriptAsync(org.opensearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest request, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.support.master.AcknowledgedResponse> listener)Asynchronously delete stored script by id.- Parameters:
request- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
putScript
public org.opensearch.action.support.master.AcknowledgedResponse putScript(org.opensearch.action.admin.cluster.storedscripts.PutStoredScriptRequest putStoredScriptRequest, org.opensearch.client.RequestOptions options) throws java.io.IOExceptionPuts an stored script using the Scripting API.- Parameters:
putStoredScriptRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customized- Returns:
- the response
- Throws:
java.io.IOException
-
putScriptAsync
public org.opensearch.client.Cancellable putScriptAsync(org.opensearch.action.admin.cluster.storedscripts.PutStoredScriptRequest putStoredScriptRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.support.master.AcknowledgedResponse> listener)Asynchronously puts an stored script using the Scripting API.- Parameters:
putStoredScriptRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
fieldCapsAsync
public final org.opensearch.client.Cancellable fieldCapsAsync(org.opensearch.action.fieldcaps.FieldCapabilitiesRequest fieldCapabilitiesRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<org.opensearch.action.fieldcaps.FieldCapabilitiesResponse> listener)Asynchronously executes a request using the Field Capabilities API.- Parameters:
fieldCapabilitiesRequest- the requestoptions- the request options (e.g. headers), useRequestOptions.DEFAULTif nothing needs to be customizedlistener- the listener to be notified upon request completion- Returns:
- cancellable that may be used to cancel the request
-
performRequestAndParseEntity
@Deprecated protected final <Req extends org.opensearch.action.ActionRequest,Resp> Resp performRequestAndParseEntity(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser, java.util.Set<java.lang.Integer> ignores) throws java.io.IOExceptionDeprecated.If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions. The Validation layer has been added to the ReST client, and requests should extendValidatableinstead ofActionRequest.- Throws:
java.io.IOException
-
performRequestAndParseEntity
protected final <Req extends Validatable,Resp> Resp performRequestAndParseEntity(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser, java.util.Set<java.lang.Integer> ignores) throws java.io.IOException
Defines a helper method for performing a request and then parsing the returned entity using the provided entityParser.- Throws:
java.io.IOException
-
performRequest
@Deprecated protected final <Req extends org.opensearch.action.ActionRequest,Resp> Resp performRequest(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.client.Response,Resp,java.io.IOException> responseConverter, java.util.Set<java.lang.Integer> ignores) throws java.io.IOExceptionDeprecated.If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions. The Validation layer has been added to the ReST client, and requests should extendValidatableinstead ofActionRequest.- Throws:
java.io.IOException
-
performRequest
protected final <Req extends Validatable,Resp> Resp performRequest(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.client.Response,Resp,java.io.IOException> responseConverter, java.util.Set<java.lang.Integer> ignores) throws java.io.IOException
Defines a helper method for performing a request.- Throws:
java.io.IOException
-
performRequestAndParseOptionalEntity
protected final <Req extends Validatable,Resp> java.util.Optional<Resp> performRequestAndParseOptionalEntity(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser) throws java.io.IOException
Defines a helper method for requests that can 404 and in which case will return an empty Optional otherwise tries to parse the response body- Throws:
java.io.IOException
-
performRequestAsyncAndParseEntity
@Deprecated protected final <Req extends org.opensearch.action.ActionRequest,Resp> org.opensearch.client.Cancellable performRequestAsyncAndParseEntity(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser, org.opensearch.action.ActionListener<Resp> listener, java.util.Set<java.lang.Integer> ignores)Deprecated.If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions. The Validation layer has been added to the ReST client, and requests should extendValidatableinstead ofActionRequest.- Returns:
- Cancellable instance that may be used to cancel the request
-
performRequestAsyncAndParseEntity
protected final <Req extends Validatable,Resp> org.opensearch.client.Cancellable performRequestAsyncAndParseEntity(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser, org.opensearch.action.ActionListener<Resp> listener, java.util.Set<java.lang.Integer> ignores)
Defines a helper method for asynchronously performing a request.- Returns:
- Cancellable instance that may be used to cancel the request
-
performRequestAsync
@Deprecated protected final <Req extends org.opensearch.action.ActionRequest,Resp> org.opensearch.client.Cancellable performRequestAsync(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.client.Response,Resp,java.io.IOException> responseConverter, org.opensearch.action.ActionListener<Resp> listener, java.util.Set<java.lang.Integer> ignores)Deprecated.If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions. The Validation layer has been added to the ReST client, and requests should extendValidatableinstead ofActionRequest.- Returns:
- Cancellable instance that may be used to cancel the request
-
performRequestAsync
protected final <Req extends Validatable,Resp> org.opensearch.client.Cancellable performRequestAsync(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.client.Response,Resp,java.io.IOException> responseConverter, org.opensearch.action.ActionListener<Resp> listener, java.util.Set<java.lang.Integer> ignores)
Defines a helper method for asynchronously performing a request.- Returns:
- Cancellable instance that may be used to cancel the request
-
performRequestAsyncAndParseOptionalEntity
protected final <Req extends Validatable,Resp> org.opensearch.client.Cancellable performRequestAsyncAndParseOptionalEntity(Req request, org.opensearch.common.CheckedFunction<Req,org.opensearch.client.Request,java.io.IOException> requestConverter, org.opensearch.client.RequestOptions options, org.opensearch.common.CheckedFunction<org.opensearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser, org.opensearch.action.ActionListener<java.util.Optional<Resp>> listener)
Asynchronous request which returns emptyOptionals in the case of 404s or parses entity into an Optional- Returns:
- Cancellable instance that may be used to cancel the request
-
parseResponseException
protected final org.opensearch.OpenSearchStatusException parseResponseException(org.opensearch.client.ResponseException responseException)
Converts aResponseExceptionobtained from the low level REST client into anOpenSearchException. If a response body was returned, tries to parse it as an error returned from OpenSearch. If no response body was returned or anything goes wrong while parsing the error, returns a newOpenSearchStatusExceptionthat wraps the originalResponseException. The potential exception obtained while parsing is added to the returned exception as a suppressed exception. This method is guaranteed to not throw any exception eventually thrown while parsing.
-
parseEntity
protected final <Resp> Resp parseEntity(org.apache.http.HttpEntity entity, org.opensearch.common.CheckedFunction<org.opensearch.common.xcontent.XContentParser,Resp,java.io.IOException> entityParser) throws java.io.IOException- Throws:
java.io.IOException
-
convertExistsResponse
protected static boolean convertExistsResponse(org.opensearch.client.Response response)
-
-