Package org.opensearch.client.opensearch
Class OpenSearchClient
java.lang.Object
org.opensearch.client.ApiClient<OpenSearchTransport,OpenSearchClient>
org.opensearch.client.opensearch.OpenSearchClientBase<OpenSearchClient>
org.opensearch.client.opensearch.OpenSearchClient
Client for the namespace.
-
Field Summary
Fields inherited from class org.opensearch.client.ApiClient
transport, transportOptions -
Constructor Summary
ConstructorsConstructorDescriptionOpenSearchClient(OpenSearchTransport transport) OpenSearchClient(OpenSearchTransport transport, TransportOptions transportOptions) -
Method Summary
Modifier and TypeMethodDescriptionbulk()Allows to perform multiple index/update/delete operations in a single request.final BulkResponseAllows to perform multiple index/update/delete operations in a single request.bulk(BulkRequest request) Allows to perform multiple index/update/delete operations in a single request.final <TDocument>
CreateResponsecreate(Function<CreateRequest.Builder<TDocument>, ObjectBuilder<CreateRequest<TDocument>>> fn) Creates a new document in the index.<TDocument>
CreateResponsecreate(CreateRequest<TDocument> request) Creates a new document in the index.final <TDocument>
ExplainResponse<TDocument> explain(Function<ExplainRequest.Builder, ObjectBuilder<ExplainRequest>> fn, Class<TDocument> tDocumentClass) Returns information about why a specific matches (or doesn't match) a query.<TDocument>
ExplainResponse<TDocument> explain(ExplainRequest request, Class<TDocument> tDocumentClass) Returns information about why a specific matches (or doesn't match) a query.generic()final <TDocument>
GetResponse<TDocument> get(Function<GetRequest.Builder, ObjectBuilder<GetRequest>> fn, Class<TDocument> tDocumentClass) Returns a document.<TDocument>
GetResponse<TDocument> get(GetRequest request, Class<TDocument> tDocumentClass) Returns a document.final <TDocument>
GetSourceResponse<TDocument> getSource(Function<GetSourceRequest.Builder, ObjectBuilder<GetSourceRequest>> fn, Class<TDocument> tDocumentClass) Returns the source of a document.<TDocument>
GetSourceResponse<TDocument> getSource(GetSourceRequest request, Class<TDocument> tDocumentClass) Returns the source of a document.final <TDocument>
IndexResponseindex(Function<IndexRequest.Builder<TDocument>, ObjectBuilder<IndexRequest<TDocument>>> fn) Creates or updates a document in an index.<TDocument>
IndexResponseindex(IndexRequest<TDocument> request) Creates or updates a document in an index.final <TDocument>
MgetResponse<TDocument> mget(Function<MgetRequest.Builder, ObjectBuilder<MgetRequest>> fn, Class<TDocument> tDocumentClass) Allows to get multiple documents in one request.<TDocument>
MgetResponse<TDocument> mget(MgetRequest request, Class<TDocument> tDocumentClass) Allows to get multiple documents in one request.final <TDocument>
MsearchResponse<TDocument> msearch(Function<MsearchRequest.Builder, ObjectBuilder<MsearchRequest>> fn, Class<TDocument> tDocumentClass) Allows to execute several search operations in one request.<TDocument>
MsearchResponse<TDocument> msearch(MsearchRequest request, Class<TDocument> tDocumentClass) Allows to execute several search operations in one request.final <TDocument>
MsearchTemplateResponse<TDocument> msearchTemplate(Function<MsearchTemplateRequest.Builder, ObjectBuilder<MsearchTemplateRequest>> fn, Class<TDocument> tDocumentClass) Allows to execute several search template operations in one request.<TDocument>
MsearchTemplateResponse<TDocument> msearchTemplate(MsearchTemplateRequest request, Class<TDocument> tDocumentClass) Allows to execute several search template operations in one request.final <TResult> ScriptsPainlessExecuteResponse<TResult> scriptsPainlessExecute(Function<ScriptsPainlessExecuteRequest.Builder, ObjectBuilder<ScriptsPainlessExecuteRequest>> fn, Class<TResult> tResultClass) Allows an arbitrary script to be executed and a result to be returned<TResult> ScriptsPainlessExecuteResponse<TResult> scriptsPainlessExecute(ScriptsPainlessExecuteRequest request, Class<TResult> tResultClass) Allows an arbitrary script to be executed and a result to be returnedfinal <TDocument>
ScrollResponse<TDocument> scroll(Function<ScrollRequest.Builder, ObjectBuilder<ScrollRequest>> fn, Class<TDocument> tDocumentClass) Allows to retrieve a large numbers of results from a single search request.<TDocument>
ScrollResponse<TDocument> scroll(ScrollRequest request, Class<TDocument> tDocumentClass) Allows to retrieve a large numbers of results from a single search request.final <TDocument>
SearchResponse<TDocument> search(Function<SearchRequest.Builder, ObjectBuilder<SearchRequest>> fn, Class<TDocument> tDocumentClass) Returns results matching a query.<TDocument>
SearchResponse<TDocument> search(SearchRequest request, Class<TDocument> tDocumentClass) Returns results matching a query.final <TDocument>
SearchTemplateResponse<TDocument> searchTemplate(Function<SearchTemplateRequest.Builder, ObjectBuilder<SearchTemplateRequest>> fn, Class<TDocument> tDocumentClass) Allows to use the Mustache language to pre-render a search definition.<TDocument>
SearchTemplateResponse<TDocument> searchTemplate(SearchTemplateRequest request, Class<TDocument> tDocumentClass) Allows to use the Mustache language to pre-render a search definition.final <TDocument>
TermvectorsResponsetermvectors(Function<TermvectorsRequest.Builder<TDocument>, ObjectBuilder<TermvectorsRequest<TDocument>>> fn) Returns information and statistics about terms in the fields of a particular document.<TDocument>
TermvectorsResponsetermvectors(TermvectorsRequest<TDocument> request) Returns information and statistics about terms in the fields of a particular document.final <TDocument,TPartialDocument>
UpdateResponse<TDocument> update(Function<UpdateRequest.Builder<TDocument, TPartialDocument>, ObjectBuilder<UpdateRequest<TDocument, TPartialDocument>>> fn, Class<TDocument> tDocumentClass) Updates a document with a script or partial document.<TDocument,TPartialDocument>
UpdateResponse<TDocument> update(UpdateRequest<TDocument, TPartialDocument> request, Class<TDocument> tDocumentClass) Updates a document with a script or partial document.withTransportOptions(TransportOptions transportOptions) Creates a new client with some request optionsMethods inherited from class org.opensearch.client.opensearch.OpenSearchClientBase
cat, clearScroll, clearScroll, clearScroll, cluster, count, count, count, createPit, createPit, danglingIndices, delete, delete, deleteAllPits, deleteAllPits, deleteAllPits, deleteByQuery, deleteByQuery, deleteByQueryRethrottle, deleteByQueryRethrottle, deletePit, deletePit, deleteScript, deleteScript, exists, exists, existsSource, existsSource, fieldCaps, fieldCaps, fieldCaps, getAllPits, getAllPits, getAllPits, getScript, getScript, getScriptContext, getScriptContext, getScriptContext, getScriptLanguages, getScriptLanguages, getScriptLanguages, indices, info, info, info, ingest, ml, mtermvectors, mtermvectors, mtermvectors, nodes, ping, ping, ping, putScript, putScript, rankEval, rankEval, reindex, reindex, reindexRethrottle, reindexRethrottle, renderSearchTemplate, renderSearchTemplate, renderSearchTemplate, searchPipeline, searchShards, searchShards, searchShards, snapshot, tasks, updateByQuery, updateByQuery, updateByQueryRethrottle, updateByQueryRethrottleMethods inherited from class org.opensearch.client.ApiClient
_transport, _transportOptions, getDeserializer
-
Constructor Details
-
OpenSearchClient
-
OpenSearchClient
-
-
Method Details
-
withTransportOptions
Description copied from class:ApiClientCreates a new client with some request options- Specified by:
withTransportOptionsin classApiClient<OpenSearchTransport,OpenSearchClient>
-
generic
-
bulk
Allows to perform multiple index/update/delete operations in a single request.- Throws:
IOExceptionOpenSearchException
-
bulk
public final BulkResponse bulk(Function<BulkRequest.Builder, ObjectBuilder<BulkRequest>> fn) throws IOException, OpenSearchExceptionAllows to perform multiple index/update/delete operations in a single request.- Parameters:
fn- a function that initializes a builder to create theBulkRequest- Throws:
IOExceptionOpenSearchException
-
bulk
Allows to perform multiple index/update/delete operations in a single request.- Throws:
IOExceptionOpenSearchException
-
create
public <TDocument> CreateResponse create(CreateRequest<TDocument> request) throws IOException, OpenSearchException Creates a new document in the index.Returns a 409 response when a document with a same ID already exists in the index.
- Throws:
IOExceptionOpenSearchException
-
create
public final <TDocument> CreateResponse create(Function<CreateRequest.Builder<TDocument>, ObjectBuilder<CreateRequest<TDocument>>> fn) throws IOException, OpenSearchExceptionCreates a new document in the index.Returns a 409 response when a document with a same ID already exists in the index.
- Parameters:
fn- a function that initializes a builder to create theCreateRequest- Throws:
IOExceptionOpenSearchException
-
explain
public <TDocument> ExplainResponse<TDocument> explain(ExplainRequest request, Class<TDocument> tDocumentClass) throws IOException, OpenSearchException Returns information about why a specific matches (or doesn't match) a query.- Throws:
IOExceptionOpenSearchException
-
explain
public final <TDocument> ExplainResponse<TDocument> explain(Function<ExplainRequest.Builder, ObjectBuilder<ExplainRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, OpenSearchExceptionReturns information about why a specific matches (or doesn't match) a query.- Parameters:
fn- a function that initializes a builder to create theExplainRequest- Throws:
IOExceptionOpenSearchException
-
get
public <TDocument> GetResponse<TDocument> get(GetRequest request, Class<TDocument> tDocumentClass) throws IOException, OpenSearchException Returns a document.- Throws:
IOExceptionOpenSearchException
-
get
public final <TDocument> GetResponse<TDocument> get(Function<GetRequest.Builder, ObjectBuilder<GetRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, OpenSearchExceptionReturns a document.- Parameters:
fn- a function that initializes a builder to create theGetRequest- Throws:
IOExceptionOpenSearchException
-
getSource
public <TDocument> GetSourceResponse<TDocument> getSource(GetSourceRequest request, Class<TDocument> tDocumentClass) throws IOException, OpenSearchException Returns the source of a document.- Throws:
IOExceptionOpenSearchException
-
getSource
public final <TDocument> GetSourceResponse<TDocument> getSource(Function<GetSourceRequest.Builder, ObjectBuilder<GetSourceRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, OpenSearchExceptionReturns the source of a document.- Parameters:
fn- a function that initializes a builder to create theGetSourceRequest- Throws:
IOExceptionOpenSearchException
-
index
public <TDocument> IndexResponse index(IndexRequest<TDocument> request) throws IOException, OpenSearchException Creates or updates a document in an index.- Throws:
IOExceptionOpenSearchException
-
index
public final <TDocument> IndexResponse index(Function<IndexRequest.Builder<TDocument>, ObjectBuilder<IndexRequest<TDocument>>> fn) throws IOException, OpenSearchExceptionCreates or updates a document in an index.- Parameters:
fn- a function that initializes a builder to create theIndexRequest- Throws:
IOExceptionOpenSearchException
-
mget
public <TDocument> MgetResponse<TDocument> mget(MgetRequest request, Class<TDocument> tDocumentClass) throws IOException, OpenSearchException Allows to get multiple documents in one request.- Throws:
IOExceptionOpenSearchException
-
mget
public final <TDocument> MgetResponse<TDocument> mget(Function<MgetRequest.Builder, ObjectBuilder<MgetRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, OpenSearchExceptionAllows to get multiple documents in one request.- Parameters:
fn- a function that initializes a builder to create theMgetRequest- Throws:
IOExceptionOpenSearchException
-
msearch
public <TDocument> MsearchResponse<TDocument> msearch(MsearchRequest request, Class<TDocument> tDocumentClass) throws IOException, OpenSearchException Allows to execute several search operations in one request.- Throws:
IOExceptionOpenSearchException
-
msearch
public final <TDocument> MsearchResponse<TDocument> msearch(Function<MsearchRequest.Builder, ObjectBuilder<MsearchRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, OpenSearchExceptionAllows to execute several search operations in one request.- Parameters:
fn- a function that initializes a builder to create theMsearchRequest- Throws:
IOExceptionOpenSearchException
-
msearchTemplate
public <TDocument> MsearchTemplateResponse<TDocument> msearchTemplate(MsearchTemplateRequest request, Class<TDocument> tDocumentClass) throws IOException, OpenSearchException Allows to execute several search template operations in one request.- Throws:
IOExceptionOpenSearchException
-
msearchTemplate
public final <TDocument> MsearchTemplateResponse<TDocument> msearchTemplate(Function<MsearchTemplateRequest.Builder, ObjectBuilder<MsearchTemplateRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, OpenSearchExceptionAllows to execute several search template operations in one request.- Parameters:
fn- a function that initializes a builder to create theMsearchTemplateRequest- Throws:
IOExceptionOpenSearchException
-
scriptsPainlessExecute
public <TResult> ScriptsPainlessExecuteResponse<TResult> scriptsPainlessExecute(ScriptsPainlessExecuteRequest request, Class<TResult> tResultClass) throws IOException, OpenSearchException Allows an arbitrary script to be executed and a result to be returned- Throws:
IOExceptionOpenSearchException
-
scriptsPainlessExecute
public final <TResult> ScriptsPainlessExecuteResponse<TResult> scriptsPainlessExecute(Function<ScriptsPainlessExecuteRequest.Builder, ObjectBuilder<ScriptsPainlessExecuteRequest>> fn, Class<TResult> tResultClass) throws IOException, OpenSearchExceptionAllows an arbitrary script to be executed and a result to be returned- Parameters:
fn- a function that initializes a builder to create theScriptsPainlessExecuteRequest- Throws:
IOExceptionOpenSearchException
-
scroll
public <TDocument> ScrollResponse<TDocument> scroll(ScrollRequest request, Class<TDocument> tDocumentClass) throws IOException, OpenSearchException Allows to retrieve a large numbers of results from a single search request.- Throws:
IOExceptionOpenSearchException
-
scroll
public final <TDocument> ScrollResponse<TDocument> scroll(Function<ScrollRequest.Builder, ObjectBuilder<ScrollRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, OpenSearchExceptionAllows to retrieve a large numbers of results from a single search request.- Parameters:
fn- a function that initializes a builder to create theScrollRequest- Throws:
IOExceptionOpenSearchException
-
search
public <TDocument> SearchResponse<TDocument> search(SearchRequest request, Class<TDocument> tDocumentClass) throws IOException, OpenSearchException Returns results matching a query.- Throws:
IOExceptionOpenSearchException
-
search
public final <TDocument> SearchResponse<TDocument> search(Function<SearchRequest.Builder, ObjectBuilder<SearchRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, OpenSearchExceptionReturns results matching a query.- Parameters:
fn- a function that initializes a builder to create theSearchRequest- Throws:
IOExceptionOpenSearchException
-
searchTemplate
public <TDocument> SearchTemplateResponse<TDocument> searchTemplate(SearchTemplateRequest request, Class<TDocument> tDocumentClass) throws IOException, OpenSearchException Allows to use the Mustache language to pre-render a search definition.- Throws:
IOExceptionOpenSearchException
-
searchTemplate
public final <TDocument> SearchTemplateResponse<TDocument> searchTemplate(Function<SearchTemplateRequest.Builder, ObjectBuilder<SearchTemplateRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, OpenSearchExceptionAllows to use the Mustache language to pre-render a search definition.- Parameters:
fn- a function that initializes a builder to create theSearchTemplateRequest- Throws:
IOExceptionOpenSearchException
-
termvectors
public <TDocument> TermvectorsResponse termvectors(TermvectorsRequest<TDocument> request) throws IOException, OpenSearchException Returns information and statistics about terms in the fields of a particular document.- Throws:
IOExceptionOpenSearchException
-
termvectors
public final <TDocument> TermvectorsResponse termvectors(Function<TermvectorsRequest.Builder<TDocument>, ObjectBuilder<TermvectorsRequest<TDocument>>> fn) throws IOException, OpenSearchExceptionReturns information and statistics about terms in the fields of a particular document.- Parameters:
fn- a function that initializes a builder to create theTermvectorsRequest- Throws:
IOExceptionOpenSearchException
-
update
public <TDocument,TPartialDocument> UpdateResponse<TDocument> update(UpdateRequest<TDocument, TPartialDocument> request, Class<TDocument> tDocumentClass) throws IOException, OpenSearchExceptionUpdates a document with a script or partial document.- Throws:
IOExceptionOpenSearchException
-
update
public final <TDocument,TPartialDocument> UpdateResponse<TDocument> update(Function<UpdateRequest.Builder<TDocument, TPartialDocument>, throws IOException, OpenSearchExceptionObjectBuilder<UpdateRequest<TDocument, TPartialDocument>>> fn, Class<TDocument> tDocumentClass) Updates a document with a script or partial document.- Parameters:
fn- a function that initializes a builder to create theUpdateRequest- Throws:
IOExceptionOpenSearchException
-