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.Closeable
High level REST client that wraps an instance of the low level RestClient and allows to build requests and read responses. The RestClient instance is internally built based on the provided RestClientBuilder and it gets closed automatically when closing the RestHighLevelClient instance 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) and searchAsync(SearchRequest, RequestOptions, ActionListener), where the later takes an implementation of an ActionListener as an argument that needs to implement methods that handle successful responses and failure scenarios. Most of the blocking calls can throw an IOException or an unchecked OpenSearchException in the following cases:

  • an IOException is 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 OpenSearchException is 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 original ResponseException
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
      RestHighLevelClient​(org.opensearch.client.RestClientBuilder restClientBuilder)
    Creates a RestHighLevelClient given the low level RestClientBuilder that allows to build the RestClient to be used to perform requests.
    protected RestHighLevelClient​(org.opensearch.client.RestClientBuilder restClientBuilder, java.util.List<org.opensearch.common.xcontent.NamedXContentRegistry.Entry> namedXContentEntries)
    Creates a RestHighLevelClient given the low level RestClientBuilder that allows to build the RestClient to be used to perform requests and parsers for custom response sections added to OpenSearch through plugins.
    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 a RestHighLevelClient given the low level RestClient that 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

    Modifier and Type Method Description
    org.opensearch.action.bulk.BulkResponse bulk​(org.opensearch.action.bulk.BulkRequest bulkRequest, org.opensearch.client.RequestOptions options)
    Executes a bulk request using the Bulk API.
    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.
    org.opensearch.action.search.ClearScrollResponse clearScroll​(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.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.
    void close()  
    ClusterClient cluster()
    Provides a ClusterClient which can be used to access the Cluster API.
    protected static boolean convertExistsResponse​(org.opensearch.client.Response response)  
    CountResponse count​(CountRequest countRequest, org.opensearch.client.RequestOptions options)
    Executes a count request using the Count API.
    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.
    org.opensearch.action.delete.DeleteResponse delete​(org.opensearch.action.delete.DeleteRequest deleteRequest, org.opensearch.client.RequestOptions options)
    Deletes a document by id using the Delete API.
    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.
    org.opensearch.index.reindex.BulkByScrollResponse deleteByQuery​(org.opensearch.index.reindex.DeleteByQueryRequest deleteByQueryRequest, org.opensearch.client.RequestOptions options)
    Executes a delete by query request.
    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.
    org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse deleteByQueryRethrottle​(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options)
    Executes a delete by query rethrottle request.
    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.
    org.opensearch.action.support.master.AcknowledgedResponse deleteScript​(org.opensearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest request, org.opensearch.client.RequestOptions options)
    Delete stored script by id.
    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.
    boolean exists​(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options)
    Checks for the existence of a document.
    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.
    boolean existsSource​(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options)
    boolean existsSource​(GetSourceRequest getSourceRequest, org.opensearch.client.RequestOptions options)
    Checks for the existence of a document with a "_source" field.
    org.opensearch.client.Cancellable existsSourceAsync​(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<java.lang.Boolean> listener)
    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.
    org.opensearch.action.explain.ExplainResponse explain​(org.opensearch.action.explain.ExplainRequest explainRequest, org.opensearch.client.RequestOptions options)
    Executes a request using the Explain API.
    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.
    org.opensearch.action.fieldcaps.FieldCapabilitiesResponse fieldCaps​(org.opensearch.action.fieldcaps.FieldCapabilitiesRequest fieldCapabilitiesRequest, org.opensearch.client.RequestOptions options)
    Executes a request using the Field Capabilities API.
    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.
    org.opensearch.action.get.GetResponse get​(org.opensearch.action.get.GetRequest getRequest, org.opensearch.client.RequestOptions options)
    Retrieves a document by id using the Get API.
    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.
    org.opensearch.client.RestClient getLowLevelClient()
    Returns the low-level client that the current high-level client instance is using to perform requests
    org.opensearch.action.admin.cluster.storedscripts.GetStoredScriptResponse getScript​(org.opensearch.action.admin.cluster.storedscripts.GetStoredScriptRequest request, org.opensearch.client.RequestOptions options)
    Get stored script by id.
    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.
    GetSourceResponse getSource​(GetSourceRequest getSourceRequest, org.opensearch.client.RequestOptions options)
    Retrieves the source field only of a document using GetSource API.
    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.
    org.opensearch.action.index.IndexResponse index​(org.opensearch.action.index.IndexRequest indexRequest, org.opensearch.client.RequestOptions options)
    Index a document using the Index API.
    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.
    IndicesClient indices()
    Provides an IndicesClient which can be used to access the Indices API.
    MainResponse info​(org.opensearch.client.RequestOptions options)
    Get the cluster info otherwise provided when sending an HTTP request to '/'
    IngestClient ingest()
    Provides a IngestClient which can be used to access the Ingest API.
    org.opensearch.action.get.MultiGetResponse mget​(org.opensearch.action.get.MultiGetRequest multiGetRequest, org.opensearch.client.RequestOptions options)
    Retrieves multiple documents by id using the Multi Get API.
    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.
    org.opensearch.action.search.MultiSearchResponse msearch​(org.opensearch.action.search.MultiSearchRequest multiSearchRequest, org.opensearch.client.RequestOptions options)
    Executes a multi search using the msearch API.
    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.
    org.opensearch.script.mustache.MultiSearchTemplateResponse msearchTemplate​(org.opensearch.script.mustache.MultiSearchTemplateRequest multiSearchTemplateRequest, org.opensearch.client.RequestOptions options)
    Executes a request using the Multi Search Template API.
    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
    MultiTermVectorsResponse mtermvectors​(MultiTermVectorsRequest request, org.opensearch.client.RequestOptions options)
    Calls the Multi Term Vectors API
    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
    org.opensearch.action.get.MultiGetResponse multiGet​(org.opensearch.action.get.MultiGetRequest multiGetRequest, org.opensearch.client.RequestOptions options)
    Deprecated.
    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)
    org.opensearch.action.search.MultiSearchResponse multiSearch​(org.opensearch.action.search.MultiSearchRequest multiSearchRequest, org.opensearch.client.RequestOptions options)
    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)
    protected <Resp> Resp parseEntity​(org.apache.http.HttpEntity entity, org.opensearch.common.CheckedFunction<org.opensearch.common.xcontent.XContentParser,​Resp,​java.io.IOException> entityParser)  
    protected org.opensearch.OpenSearchStatusException parseResponseException​(org.opensearch.client.ResponseException responseException)
    Converts a ResponseException obtained from the low level REST client into an OpenSearchException.
    protected <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)
    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>
    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)
    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 body
    protected <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.
    protected <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.
    protected <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 empty Optionals in the case of 404s or parses entity into an Optional
    boolean ping​(org.opensearch.client.RequestOptions options)
    Pings the remote OpenSearch cluster and returns true if the ping succeeded, false otherwise
    org.opensearch.action.support.master.AcknowledgedResponse putScript​(org.opensearch.action.admin.cluster.storedscripts.PutStoredScriptRequest putStoredScriptRequest, org.opensearch.client.RequestOptions options)
    Puts an stored script using the Scripting API.
    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.
    org.opensearch.index.rankeval.RankEvalResponse rankEval​(org.opensearch.index.rankeval.RankEvalRequest rankEvalRequest, org.opensearch.client.RequestOptions options)
    Executes a request using the Ranking Evaluation API.
    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.
    org.opensearch.index.reindex.BulkByScrollResponse reindex​(org.opensearch.index.reindex.ReindexRequest reindexRequest, org.opensearch.client.RequestOptions options)
    Executes a reindex request.
    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.
    org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse reindexRethrottle​(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options)
    Executes a reindex rethrottling request.
    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.
    org.opensearch.action.search.SearchResponse scroll​(org.opensearch.action.search.SearchScrollRequest searchScrollRequest, org.opensearch.client.RequestOptions options)
    Executes a search using the Search Scroll API.
    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.
    org.opensearch.action.search.SearchResponse search​(org.opensearch.action.search.SearchRequest searchRequest, org.opensearch.client.RequestOptions options)
    Executes a search request using the Search API.
    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.
    org.opensearch.action.search.SearchResponse searchScroll​(org.opensearch.action.search.SearchScrollRequest searchScrollRequest, org.opensearch.client.RequestOptions options)
    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)
    org.opensearch.script.mustache.SearchTemplateResponse searchTemplate​(org.opensearch.script.mustache.SearchTemplateRequest searchTemplateRequest, org.opensearch.client.RequestOptions options)
    Executes a request using the Search Template API.
    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.
    SnapshotClient snapshot()
    Provides a SnapshotClient which can be used to access the Snapshot API.
    TaskSubmissionResponse submitDeleteByQueryTask​(org.opensearch.index.reindex.DeleteByQueryRequest deleteByQueryRequest, org.opensearch.client.RequestOptions options)
    Submits a delete by query task
    TaskSubmissionResponse submitReindexTask​(org.opensearch.index.reindex.ReindexRequest reindexRequest, org.opensearch.client.RequestOptions options)
    Submits a reindex task.
    TaskSubmissionResponse submitUpdateByQueryTask​(org.opensearch.index.reindex.UpdateByQueryRequest updateByQueryRequest, org.opensearch.client.RequestOptions options)
    Submits a update by query task.
    TasksClient tasks()
    Provides a TasksClient which can be used to access the Tasks API.
    TermVectorsResponse termvectors​(TermVectorsRequest request, org.opensearch.client.RequestOptions options)
    Calls the Term Vectors API
    org.opensearch.client.Cancellable termvectorsAsync​(TermVectorsRequest request, org.opensearch.client.RequestOptions options, org.opensearch.action.ActionListener<TermVectorsResponse> listener)
    Asynchronously calls the Term Vectors API
    org.opensearch.action.update.UpdateResponse update​(org.opensearch.action.update.UpdateRequest updateRequest, org.opensearch.client.RequestOptions options)
    Updates a document using the Update API.
    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.
    org.opensearch.index.reindex.BulkByScrollResponse updateByQuery​(org.opensearch.index.reindex.UpdateByQueryRequest updateByQueryRequest, org.opensearch.client.RequestOptions options)
    Executes a update by query request.
    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.
    org.opensearch.action.admin.cluster.node.tasks.list.ListTasksResponse updateByQueryRethrottle​(RethrottleRequest rethrottleRequest, org.opensearch.client.RequestOptions options)
    Executes a update by query rethrottle request.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RestHighLevelClient

      public RestHighLevelClient​(org.opensearch.client.RestClientBuilder restClientBuilder)
      Creates a RestHighLevelClient given the low level RestClientBuilder that allows to build the RestClient to be used to perform requests.
    • RestHighLevelClient

      protected RestHighLevelClient​(org.opensearch.client.RestClientBuilder restClientBuilder, java.util.List<org.opensearch.common.xcontent.NamedXContentRegistry.Entry> namedXContentEntries)
      Creates a RestHighLevelClient given the low level RestClientBuilder that allows to build the RestClient to 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 a RestHighLevelClient given the low level RestClient that 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 the close() method is called. Also subclasses can provide parsers for custom response sections added to OpenSearch through plugins.
  • Method Details

    • 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:
      close in interface java.lang.AutoCloseable
      Specified by:
      close in interface java.io.Closeable
      Throws:
      java.io.IOException
    • indices

      public final IndicesClient indices()
      Provides an IndicesClient which can be used to access the Indices API.
    • cluster

      public final ClusterClient cluster()
      Provides a ClusterClient which can be used to access the Cluster API.
    • ingest

      public final IngestClient ingest()
      Provides a IngestClient which can be used to access the Ingest API.
    • snapshot

      public final SnapshotClient snapshot()
      Provides a SnapshotClient which can be used to access the Snapshot API.
    • tasks

      public final TasksClient tasks()
      Provides a TasksClient which 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.IOException
      Executes a bulk request using the Bulk API.
      Parameters:
      bulkRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Executes a reindex request.
      Parameters:
      reindexRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Executes a update by query request.
      Parameters:
      updateByQueryRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Executes a delete by query request.
      Parameters:
      deleteByQueryRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Pings the remote OpenSearch cluster and returns true if the ping succeeded, false otherwise
      Parameters:
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      Returns:
      true if 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), use RequestOptions.DEFAULT if 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.IOException
      Retrieves a document by id using the Get API.
      Parameters:
      getRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Deprecated.
      Retrieves multiple documents by id using the Multi Get API.
      Parameters:
      multiGetRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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.IOException
      Retrieves multiple documents by id using the Multi Get API.
      Parameters:
      multiGetRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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)
      Asynchronously retrieves multiple documents by id using the Multi Get API.
      Parameters:
      multiGetRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Checks for the existence of a document. Returns true if it exists, false otherwise.
      Parameters:
      getRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      Returns:
      true if the document exists, false otherwise
      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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Checks for the existence of a document with a "_source" field. Returns true if it exists, false otherwise.
      Parameters:
      getRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      Returns:
      true if the document and _source field exists, false otherwise
      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)
      Asynchronously checks for the existence of a document with a "_source" field. Returns true if it exists, false otherwise.
      Parameters:
      getRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      Returns:
      true if the document and _source field exists, false otherwise
      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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Index a document using the Index API.
      Parameters:
      indexRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Updates a document using the Update API.
      Parameters:
      updateRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Deletes a document by id using the Delete API.
      Parameters:
      deleteRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Executes a search request using the Search API.
      Parameters:
      searchRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Executes a multi search using the msearch API.
      Parameters:
      multiSearchRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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.IOException
      Executes a multi search using the msearch API.
      Parameters:
      multiSearchRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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)
      Asynchronously executes a multi search using the msearch API.
      Parameters:
      searchRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Executes a search using the Search Scroll API.
      Parameters:
      searchScrollRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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.IOException
      Executes a search using the Search Scroll API.
      Parameters:
      searchScrollRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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)
      Asynchronously executes a search using the Search Scroll API.
      Parameters:
      searchScrollRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Clears one or more scroll ids using the Clear Scroll API.
      Parameters:
      clearScrollRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Executes a request using the Search Template API.
      Parameters:
      searchTemplateRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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.IOException
      Executes a request using the Explain API.
      Parameters:
      explainRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Executes a request using the Ranking Evaluation API.
      Parameters:
      rankEvalRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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.IOException
      Executes 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Executes a request using the Field Capabilities API.
      Parameters:
      fieldCapabilitiesRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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.IOException
      Get stored script by id.
      Parameters:
      request - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Delete stored script by id.
      Parameters:
      request - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      Puts an stored script using the Scripting API.
      Parameters:
      putStoredScriptRequest - the request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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 request
      options - the request options (e.g. headers), use RequestOptions.DEFAULT if nothing needs to be customized
      listener - 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.IOException
      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 extend Validatable instead of ActionRequest.
      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.IOException
      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 extend Validatable instead of ActionRequest.
      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 extend Validatable instead of ActionRequest.
      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 extend Validatable instead of ActionRequest.
      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 empty Optionals 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 a ResponseException obtained from the low level REST client into an OpenSearchException. 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 new OpenSearchStatusException that wraps the original ResponseException. 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)