Class ElasticsearchClient
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Field Summary
Fields inherited from class co.elastic.clients.ApiClient
transport, transportOptions -
Constructor Summary
ConstructorsConstructorDescriptionElasticsearchClient(ElasticsearchTransport transport) ElasticsearchClient(ElasticsearchTransport transport, TransportOptions transportOptions) -
Method Summary
Modifier and TypeMethodDescriptionbulk()Bulk index or delete documents.bulk(BulkRequest request) Bulk index or delete documents.final BulkResponseBulk index or delete documents.cat()ccr()Clear a scrolling search.clearScroll(ClearScrollRequest request) Clear a scrolling search.final ClearScrollResponseClear a scrolling search.closePointInTime(ClosePointInTimeRequest request) Close a point in time.final ClosePointInTimeResponseclosePointInTime(Function<ClosePointInTimeRequest.Builder, ObjectBuilder<ClosePointInTimeRequest>> fn) Close a point in time.cluster()count()Returns number of documents matching a query.count(CountRequest request) Returns number of documents matching a query.final CountResponseReturns number of documents matching a query.<TDocument>
CreateResponsecreate(CreateRequest<TDocument> request) Index a document.final <TDocument>
CreateResponsecreate(Function<CreateRequest.Builder<TDocument>, ObjectBuilder<CreateRequest<TDocument>>> fn) Index a document.delete(DeleteRequest request) Delete a document.final DeleteResponseDelete a document.deleteByQuery(DeleteByQueryRequest request) Delete documents.final DeleteByQueryResponseDelete documents.Throttle a delete by query operation.deleteByQueryRethrottle(Function<DeleteByQueryRethrottleRequest.Builder, ObjectBuilder<DeleteByQueryRethrottleRequest>> fn) Throttle a delete by query operation.deleteScript(DeleteScriptRequest request) Delete a script or search template.final DeleteScriptResponseDelete a script or search template.enrich()eql()esql()exists(ExistsRequest request) Check a document.final BooleanResponseCheck a document.existsSource(ExistsSourceRequest request) Check for a document source.final BooleanResponseCheck for a document source.<TDocument>
ExplainResponse<TDocument>explain(ExplainRequest request, Class<TDocument> tDocumentClass) Explain a document match result.<TDocument>
ExplainResponse<TDocument>explain(ExplainRequest request, Type tDocumentType) Explain a document match result.final <TDocument>
ExplainResponse<TDocument>explain(Function<ExplainRequest.Builder, ObjectBuilder<ExplainRequest>> fn, Class<TDocument> tDocumentClass) Explain a document match result.final <TDocument>
ExplainResponse<TDocument>explain(Function<ExplainRequest.Builder, ObjectBuilder<ExplainRequest>> fn, Type tDocumentType) Explain a document match result.features()Get the field capabilities.fieldCaps(FieldCapsRequest request) Get the field capabilities.final FieldCapsResponseGet the field capabilities.fleet()<TDocument>
GetResponse<TDocument>get(GetRequest request, Class<TDocument> tDocumentClass) Get a document by its ID.<TDocument>
GetResponse<TDocument>get(GetRequest request, Type tDocumentType) Get a document by its ID.final <TDocument>
GetResponse<TDocument>get(Function<GetRequest.Builder, ObjectBuilder<GetRequest>> fn, Class<TDocument> tDocumentClass) Get a document by its ID.final <TDocument>
GetResponse<TDocument>get(Function<GetRequest.Builder, ObjectBuilder<GetRequest>> fn, Type tDocumentType) Get a document by its ID.getScript(GetScriptRequest request) Get a script or search template.final GetScriptResponseGet a script or search template.Get script contexts.Get script languages.<TDocument>
GetSourceResponse<TDocument>getSource(GetSourceRequest request, Class<TDocument> tDocumentClass) Get a document's source.<TDocument>
GetSourceResponse<TDocument>getSource(GetSourceRequest request, Type tDocumentType) Get a document's source.final <TDocument>
GetSourceResponse<TDocument>getSource(Function<GetSourceRequest.Builder, ObjectBuilder<GetSourceRequest>> fn, Class<TDocument> tDocumentClass) Get a document's source.final <TDocument>
GetSourceResponse<TDocument>getSource(Function<GetSourceRequest.Builder, ObjectBuilder<GetSourceRequest>> fn, Type tDocumentType) Get a document's source.graph()Returns the health of the cluster.healthReport(HealthReportRequest request) Returns the health of the cluster.final HealthReportResponseReturns the health of the cluster.ilm()<TDocument>
IndexResponseindex(IndexRequest<TDocument> request) Index a document.final <TDocument>
IndexResponseindex(Function<IndexRequest.Builder<TDocument>, ObjectBuilder<IndexRequest<TDocument>>> fn) Index a document.indices()info()Get cluster info.ingest()<TDocument>
KnnSearchResponse<TDocument>knnSearch(KnnSearchRequest request, Class<TDocument> tDocumentClass) Run a knn search.<TDocument>
KnnSearchResponse<TDocument>knnSearch(KnnSearchRequest request, Type tDocumentType) Run a knn search.final <TDocument>
KnnSearchResponse<TDocument>knnSearch(Function<KnnSearchRequest.Builder, ObjectBuilder<KnnSearchRequest>> fn, Class<TDocument> tDocumentClass) Run a knn search.final <TDocument>
KnnSearchResponse<TDocument>knnSearch(Function<KnnSearchRequest.Builder, ObjectBuilder<KnnSearchRequest>> fn, Type tDocumentType) Run a knn search.license()logstash()<TDocument>
MgetResponse<TDocument>mget(MgetRequest request, Class<TDocument> tDocumentClass) Get multiple documents.<TDocument>
MgetResponse<TDocument>mget(MgetRequest request, Type tDocumentType) Get multiple documents.final <TDocument>
MgetResponse<TDocument>mget(Function<MgetRequest.Builder, ObjectBuilder<MgetRequest>> fn, Class<TDocument> tDocumentClass) Get multiple documents.final <TDocument>
MgetResponse<TDocument>mget(Function<MgetRequest.Builder, ObjectBuilder<MgetRequest>> fn, Type tDocumentType) Get multiple documents.ml()<TDocument>
MsearchResponse<TDocument>msearch(MsearchRequest request, Class<TDocument> tDocumentClass) Run multiple searches.<TDocument>
MsearchResponse<TDocument>msearch(MsearchRequest request, Type tDocumentType) Run multiple searches.final <TDocument>
MsearchResponse<TDocument>msearch(Function<MsearchRequest.Builder, ObjectBuilder<MsearchRequest>> fn, Class<TDocument> tDocumentClass) Run multiple searches.final <TDocument>
MsearchResponse<TDocument>msearch(Function<MsearchRequest.Builder, ObjectBuilder<MsearchRequest>> fn, Type tDocumentType) Run multiple searches.<TDocument>
MsearchTemplateResponse<TDocument>msearchTemplate(MsearchTemplateRequest request, Class<TDocument> tDocumentClass) Run multiple templated searches.<TDocument>
MsearchTemplateResponse<TDocument>msearchTemplate(MsearchTemplateRequest request, Type tDocumentType) Run multiple templated searches.final <TDocument>
MsearchTemplateResponse<TDocument>msearchTemplate(Function<MsearchTemplateRequest.Builder, ObjectBuilder<MsearchTemplateRequest>> fn, Class<TDocument> tDocumentClass) Run multiple templated searches.final <TDocument>
MsearchTemplateResponse<TDocument>msearchTemplate(Function<MsearchTemplateRequest.Builder, ObjectBuilder<MsearchTemplateRequest>> fn, Type tDocumentType) Run multiple templated searches.Get multiple term vectors.mtermvectors(MtermvectorsRequest request) Get multiple term vectors.final MtermvectorsResponseGet multiple term vectors.nodes()openPointInTime(OpenPointInTimeRequest request) Open a point in time.final OpenPointInTimeResponseOpen a point in time.ping()Ping the cluster.putScript(PutScriptRequest request) Create or update a script or search template.final PutScriptResponseCreate or update a script or search template.rankEval(RankEvalRequest request) Evaluate ranked search results.final RankEvalResponseEvaluate ranked search results.reindex(ReindexRequest request) Reindex documents.final ReindexResponseReindex documents.Throttle a reindex operation.reindexRethrottle(Function<ReindexRethrottleRequest.Builder, ObjectBuilder<ReindexRethrottleRequest>> fn) Throttle a reindex operation.Render a search template.Render a search template.renderSearchTemplate(Function<RenderSearchTemplateRequest.Builder, ObjectBuilder<RenderSearchTemplateRequest>> fn) Render a search template.rollup()<TResult> ScriptsPainlessExecuteResponse<TResult>scriptsPainlessExecute(ScriptsPainlessExecuteRequest request, Class<TResult> tResultClass) Run a script.<TResult> ScriptsPainlessExecuteResponse<TResult>scriptsPainlessExecute(ScriptsPainlessExecuteRequest request, Type tResultType) Run a script.final <TResult> ScriptsPainlessExecuteResponse<TResult>scriptsPainlessExecute(Function<ScriptsPainlessExecuteRequest.Builder, ObjectBuilder<ScriptsPainlessExecuteRequest>> fn, Class<TResult> tResultClass) Run a script.final <TResult> ScriptsPainlessExecuteResponse<TResult>scriptsPainlessExecute(Function<ScriptsPainlessExecuteRequest.Builder, ObjectBuilder<ScriptsPainlessExecuteRequest>> fn, Type tResultType) Run a script.<TDocument>
ScrollResponse<TDocument>scroll(ScrollRequest request, Class<TDocument> tDocumentClass) Run a scrolling search.<TDocument>
ScrollResponse<TDocument>scroll(ScrollRequest request, Type tDocumentType) Run a scrolling search.final <TDocument>
ScrollResponse<TDocument>scroll(Function<ScrollRequest.Builder, ObjectBuilder<ScrollRequest>> fn, Class<TDocument> tDocumentClass) Run a scrolling search.final <TDocument>
ScrollResponse<TDocument>scroll(Function<ScrollRequest.Builder, ObjectBuilder<ScrollRequest>> fn, Type tDocumentType) Run a scrolling search.<TDocument>
SearchResponse<TDocument>search(SearchRequest request, Class<TDocument> tDocumentClass) Run a search.<TDocument>
SearchResponse<TDocument>search(SearchRequest request, Type tDocumentType) Run a search.final <TDocument>
SearchResponse<TDocument>search(Function<SearchRequest.Builder, ObjectBuilder<SearchRequest>> fn, Class<TDocument> tDocumentClass) Run a search.final <TDocument>
SearchResponse<TDocument>search(Function<SearchRequest.Builder, ObjectBuilder<SearchRequest>> fn, Type tDocumentType) Run a search.searchMvt(SearchMvtRequest request) Search a vector tile.final BinaryResponseSearch a vector tile.Get the search shards.searchShards(SearchShardsRequest request) Get the search shards.final SearchShardsResponseGet the search shards.<TDocument>
SearchTemplateResponse<TDocument>searchTemplate(SearchTemplateRequest request, Class<TDocument> tDocumentClass) Run a search with a search template.<TDocument>
SearchTemplateResponse<TDocument>searchTemplate(SearchTemplateRequest request, Type tDocumentType) Run a search with a search template.final <TDocument>
SearchTemplateResponse<TDocument>searchTemplate(Function<SearchTemplateRequest.Builder, ObjectBuilder<SearchTemplateRequest>> fn, Class<TDocument> tDocumentClass) Run a search with a search template.final <TDocument>
SearchTemplateResponse<TDocument>searchTemplate(Function<SearchTemplateRequest.Builder, ObjectBuilder<SearchTemplateRequest>> fn, Type tDocumentType) Run a search with a search template.security()shutdown()slm()snapshot()sql()ssl()synonyms()tasks()termsEnum(TermsEnumRequest request) Get terms in an index.final TermsEnumResponseGet terms in an index.<TDocument>
TermvectorsResponsetermvectors(TermvectorsRequest<TDocument> request) Get term vector information.final <TDocument>
TermvectorsResponsetermvectors(Function<TermvectorsRequest.Builder<TDocument>, ObjectBuilder<TermvectorsRequest<TDocument>>> fn) Get term vector information.<TDocument,TPartialDocument>
UpdateResponse<TDocument>update(UpdateRequest<TDocument, TPartialDocument> request, Class<TDocument> tDocumentClass) Update a document.<TDocument,TPartialDocument>
UpdateResponse<TDocument>update(UpdateRequest<TDocument, TPartialDocument> request, Type tDocumentType) Update a document.final <TDocument,TPartialDocument>
UpdateResponse<TDocument>update(Function<UpdateRequest.Builder<TDocument, TPartialDocument>, ObjectBuilder<UpdateRequest<TDocument, TPartialDocument>>> fn, Class<TDocument> tDocumentClass) Update a document.final <TDocument,TPartialDocument>
UpdateResponse<TDocument>update(Function<UpdateRequest.Builder<TDocument, TPartialDocument>, ObjectBuilder<UpdateRequest<TDocument, TPartialDocument>>> fn, Type tDocumentType) Update a document.updateByQuery(UpdateByQueryRequest request) Update documents.final UpdateByQueryResponseUpdate documents.Throttle an update by query operation.updateByQueryRethrottle(Function<UpdateByQueryRethrottleRequest.Builder, ObjectBuilder<UpdateByQueryRethrottleRequest>> fn) Throttle an update by query operation.watcher()withTransportOptions(TransportOptions transportOptions) Creates a new client with some request optionsxpack()Methods inherited from class co.elastic.clients.ApiClient
_jsonpMapper, _transport, _transportOptions, close, getDeserializer, withTransportOptions
-
Constructor Details
-
ElasticsearchClient
-
ElasticsearchClient
public ElasticsearchClient(ElasticsearchTransport transport, @Nullable TransportOptions transportOptions)
-
-
Method Details
-
withTransportOptions
Description copied from class:ApiClientCreates a new client with some request options- Specified by:
withTransportOptionsin classApiClient<ElasticsearchTransport,ElasticsearchClient>
-
asyncSearch
-
autoscaling
-
cat
-
ccr
-
cluster
-
connector
-
danglingIndices
-
enrich
-
eql
-
esql
-
features
-
fleet
-
graph
-
ilm
-
indices
-
inference
-
ingest
-
license
-
logstash
-
migration
-
ml
-
monitoring
-
nodes
-
queryRules
-
rollup
-
searchApplication
-
searchableSnapshots
-
security
-
shutdown
-
slm
-
snapshot
-
sql
-
ssl
-
synonyms
-
tasks
-
textStructure
-
transform
-
watcher
-
xpack
-
bulk
Bulk index or delete documents. Performs multiple indexing or delete operations in a single API call. This reduces overhead and can greatly increase indexing speed.- Throws:
IOExceptionElasticsearchException- See Also:
-
bulk
public final BulkResponse bulk(Function<BulkRequest.Builder, ObjectBuilder<BulkRequest>> fn) throws IOException, ElasticsearchExceptionBulk index or delete documents. Performs multiple indexing or delete operations in a single API call. This reduces overhead and can greatly increase indexing speed.- Parameters:
fn- a function that initializes a builder to create theBulkRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
bulk
Bulk index or delete documents. Performs multiple indexing or delete operations in a single API call. This reduces overhead and can greatly increase indexing speed.- Throws:
IOExceptionElasticsearchException- See Also:
-
clearScroll
public ClearScrollResponse clearScroll(ClearScrollRequest request) throws IOException, ElasticsearchException Clear a scrolling search.Clear the search context and results for a scrolling search.
- Throws:
IOExceptionElasticsearchException- See Also:
-
clearScroll
public final ClearScrollResponse clearScroll(Function<ClearScrollRequest.Builder, ObjectBuilder<ClearScrollRequest>> fn) throws IOException, ElasticsearchExceptionClear a scrolling search.Clear the search context and results for a scrolling search.
- Parameters:
fn- a function that initializes a builder to create theClearScrollRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
clearScroll
Clear a scrolling search.Clear the search context and results for a scrolling search.
- Throws:
IOExceptionElasticsearchException- See Also:
-
closePointInTime
public ClosePointInTimeResponse closePointInTime(ClosePointInTimeRequest request) throws IOException, ElasticsearchException Close a point in time.A point in time must be opened explicitly before being used in search requests. The
keep_aliveparameter tells Elasticsearch how long it should persist. A point in time is automatically closed when thekeep_aliveperiod has elapsed. However, keeping points in time has a cost; close them as soon as they are no longer required for search requests.- Throws:
IOExceptionElasticsearchException- See Also:
-
closePointInTime
public final ClosePointInTimeResponse closePointInTime(Function<ClosePointInTimeRequest.Builder, ObjectBuilder<ClosePointInTimeRequest>> fn) throws IOException, ElasticsearchExceptionClose a point in time.A point in time must be opened explicitly before being used in search requests. The
keep_aliveparameter tells Elasticsearch how long it should persist. A point in time is automatically closed when thekeep_aliveperiod has elapsed. However, keeping points in time has a cost; close them as soon as they are no longer required for search requests.- Parameters:
fn- a function that initializes a builder to create theClosePointInTimeRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
count
Returns number of documents matching a query.- Throws:
IOExceptionElasticsearchException- See Also:
-
count
public final CountResponse count(Function<CountRequest.Builder, ObjectBuilder<CountRequest>> fn) throws IOException, ElasticsearchExceptionReturns number of documents matching a query.- Parameters:
fn- a function that initializes a builder to create theCountRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
count
Returns number of documents matching a query.- Throws:
IOExceptionElasticsearchException- See Also:
-
create
public <TDocument> CreateResponse create(CreateRequest<TDocument> request) throws IOException, ElasticsearchException Index a document. Adds a JSON document to the specified data stream or index and makes it searchable. If the target is an index and the document already exists, the request updates the document and increments its version.- Throws:
IOExceptionElasticsearchException- See Also:
-
create
public final <TDocument> CreateResponse create(Function<CreateRequest.Builder<TDocument>, ObjectBuilder<CreateRequest<TDocument>>> fn) throws IOException, ElasticsearchExceptionIndex a document. Adds a JSON document to the specified data stream or index and makes it searchable. If the target is an index and the document already exists, the request updates the document and increments its version.- Parameters:
fn- a function that initializes a builder to create theCreateRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
delete
Delete a document. Removes a JSON document from the specified index.- Throws:
IOExceptionElasticsearchException- See Also:
-
delete
public final DeleteResponse delete(Function<DeleteRequest.Builder, ObjectBuilder<DeleteRequest>> fn) throws IOException, ElasticsearchExceptionDelete a document. Removes a JSON document from the specified index.- Parameters:
fn- a function that initializes a builder to create theDeleteRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
deleteByQuery
public DeleteByQueryResponse deleteByQuery(DeleteByQueryRequest request) throws IOException, ElasticsearchException Delete documents. Deletes documents that match the specified query.- Throws:
IOExceptionElasticsearchException- See Also:
-
deleteByQuery
public final DeleteByQueryResponse deleteByQuery(Function<DeleteByQueryRequest.Builder, ObjectBuilder<DeleteByQueryRequest>> fn) throws IOException, ElasticsearchExceptionDelete documents. Deletes documents that match the specified query.- Parameters:
fn- a function that initializes a builder to create theDeleteByQueryRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
deleteByQueryRethrottle
public DeleteByQueryRethrottleResponse deleteByQueryRethrottle(DeleteByQueryRethrottleRequest request) throws IOException, ElasticsearchException Throttle a delete by query operation.Change the number of requests per second for a particular delete by query operation. Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.
- Throws:
IOExceptionElasticsearchException- See Also:
-
deleteByQueryRethrottle
public final DeleteByQueryRethrottleResponse deleteByQueryRethrottle(Function<DeleteByQueryRethrottleRequest.Builder, ObjectBuilder<DeleteByQueryRethrottleRequest>> fn) throws IOException, ElasticsearchExceptionThrottle a delete by query operation.Change the number of requests per second for a particular delete by query operation. Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.
- Parameters:
fn- a function that initializes a builder to create theDeleteByQueryRethrottleRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
deleteScript
public DeleteScriptResponse deleteScript(DeleteScriptRequest request) throws IOException, ElasticsearchException Delete a script or search template. Deletes a stored script or search template.- Throws:
IOExceptionElasticsearchException- See Also:
-
deleteScript
public final DeleteScriptResponse deleteScript(Function<DeleteScriptRequest.Builder, ObjectBuilder<DeleteScriptRequest>> fn) throws IOException, ElasticsearchExceptionDelete a script or search template. Deletes a stored script or search template.- Parameters:
fn- a function that initializes a builder to create theDeleteScriptRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
exists
Check a document. Checks if a specified document exists.- Throws:
IOExceptionElasticsearchException- See Also:
-
exists
public final BooleanResponse exists(Function<ExistsRequest.Builder, ObjectBuilder<ExistsRequest>> fn) throws IOException, ElasticsearchExceptionCheck a document. Checks if a specified document exists.- Parameters:
fn- a function that initializes a builder to create theExistsRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
existsSource
public BooleanResponse existsSource(ExistsSourceRequest request) throws IOException, ElasticsearchException Check for a document source. Checks if a document's_sourceis stored.- Throws:
IOExceptionElasticsearchException- See Also:
-
existsSource
public final BooleanResponse existsSource(Function<ExistsSourceRequest.Builder, ObjectBuilder<ExistsSourceRequest>> fn) throws IOException, ElasticsearchExceptionCheck for a document source. Checks if a document's_sourceis stored.- Parameters:
fn- a function that initializes a builder to create theExistsSourceRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
explain
public <TDocument> ExplainResponse<TDocument> explain(ExplainRequest request, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException Explain a document match result. Returns information about why a specific document matches, or doesn’t match, a query.- Throws:
IOExceptionElasticsearchException- See Also:
-
explain
public final <TDocument> ExplainResponse<TDocument> explain(Function<ExplainRequest.Builder, ObjectBuilder<ExplainRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchExceptionExplain a document match result. Returns information about why a specific document matches, or doesn’t match, a query.- Parameters:
fn- a function that initializes a builder to create theExplainRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
explain
public <TDocument> ExplainResponse<TDocument> explain(ExplainRequest request, Type tDocumentType) throws IOException, ElasticsearchException Explain a document match result. Returns information about why a specific document matches, or doesn’t match, a query.- Throws:
IOExceptionElasticsearchException- See Also:
-
explain
public final <TDocument> ExplainResponse<TDocument> explain(Function<ExplainRequest.Builder, ObjectBuilder<ExplainRequest>> fn, Type tDocumentType) throws IOException, ElasticsearchExceptionExplain a document match result. Returns information about why a specific document matches, or doesn’t match, a query.- Parameters:
fn- a function that initializes a builder to create theExplainRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
fieldCaps
public FieldCapsResponse fieldCaps(FieldCapsRequest request) throws IOException, ElasticsearchException Get the field capabilities.Get information about the capabilities of fields among multiple indices.
For data streams, the API returns field capabilities among the stream’s backing indices. It returns runtime fields like any other field. For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the
keywordfamily.- Throws:
IOExceptionElasticsearchException- See Also:
-
fieldCaps
public final FieldCapsResponse fieldCaps(Function<FieldCapsRequest.Builder, ObjectBuilder<FieldCapsRequest>> fn) throws IOException, ElasticsearchExceptionGet the field capabilities.Get information about the capabilities of fields among multiple indices.
For data streams, the API returns field capabilities among the stream’s backing indices. It returns runtime fields like any other field. For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the
keywordfamily.- Parameters:
fn- a function that initializes a builder to create theFieldCapsRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
fieldCaps
Get the field capabilities.Get information about the capabilities of fields among multiple indices.
For data streams, the API returns field capabilities among the stream’s backing indices. It returns runtime fields like any other field. For example, a runtime field with a type of keyword is returned the same as any other field that belongs to the
keywordfamily.- Throws:
IOExceptionElasticsearchException- See Also:
-
get
public <TDocument> GetResponse<TDocument> get(GetRequest request, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException Get a document by its ID. Retrieves the document with the specified ID from an index.- Throws:
IOExceptionElasticsearchException- See Also:
-
get
public final <TDocument> GetResponse<TDocument> get(Function<GetRequest.Builder, ObjectBuilder<GetRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchExceptionGet a document by its ID. Retrieves the document with the specified ID from an index.- Parameters:
fn- a function that initializes a builder to create theGetRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
get
public <TDocument> GetResponse<TDocument> get(GetRequest request, Type tDocumentType) throws IOException, ElasticsearchException Get a document by its ID. Retrieves the document with the specified ID from an index.- Throws:
IOExceptionElasticsearchException- See Also:
-
get
public final <TDocument> GetResponse<TDocument> get(Function<GetRequest.Builder, ObjectBuilder<GetRequest>> fn, Type tDocumentType) throws IOException, ElasticsearchExceptionGet a document by its ID. Retrieves the document with the specified ID from an index.- Parameters:
fn- a function that initializes a builder to create theGetRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
getScript
public GetScriptResponse getScript(GetScriptRequest request) throws IOException, ElasticsearchException Get a script or search template. Retrieves a stored script or search template.- Throws:
IOExceptionElasticsearchException- See Also:
-
getScript
public final GetScriptResponse getScript(Function<GetScriptRequest.Builder, ObjectBuilder<GetScriptRequest>> fn) throws IOException, ElasticsearchExceptionGet a script or search template. Retrieves a stored script or search template.- Parameters:
fn- a function that initializes a builder to create theGetScriptRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
getScriptContext
Get script contexts.Get a list of supported script contexts and their methods.
- Throws:
IOExceptionElasticsearchException- See Also:
-
getScriptLanguages
Get script languages.Get a list of available script types, languages, and contexts.
- Throws:
IOExceptionElasticsearchException- See Also:
-
getSource
public <TDocument> GetSourceResponse<TDocument> getSource(GetSourceRequest request, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException Get a document's source. Returns the source of a document.- Throws:
IOExceptionElasticsearchException- See Also:
-
getSource
public final <TDocument> GetSourceResponse<TDocument> getSource(Function<GetSourceRequest.Builder, ObjectBuilder<GetSourceRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchExceptionGet a document's source. Returns the source of a document.- Parameters:
fn- a function that initializes a builder to create theGetSourceRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
getSource
public <TDocument> GetSourceResponse<TDocument> getSource(GetSourceRequest request, Type tDocumentType) throws IOException, ElasticsearchException Get a document's source. Returns the source of a document.- Throws:
IOExceptionElasticsearchException- See Also:
-
getSource
public final <TDocument> GetSourceResponse<TDocument> getSource(Function<GetSourceRequest.Builder, ObjectBuilder<GetSourceRequest>> fn, Type tDocumentType) throws IOException, ElasticsearchExceptionGet a document's source. Returns the source of a document.- Parameters:
fn- a function that initializes a builder to create theGetSourceRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
healthReport
public HealthReportResponse healthReport(HealthReportRequest request) throws IOException, ElasticsearchException Returns the health of the cluster.- Throws:
IOExceptionElasticsearchException- See Also:
-
healthReport
public final HealthReportResponse healthReport(Function<HealthReportRequest.Builder, ObjectBuilder<HealthReportRequest>> fn) throws IOException, ElasticsearchExceptionReturns the health of the cluster.- Parameters:
fn- a function that initializes a builder to create theHealthReportRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
healthReport
Returns the health of the cluster.- Throws:
IOExceptionElasticsearchException- See Also:
-
index
public <TDocument> IndexResponse index(IndexRequest<TDocument> request) throws IOException, ElasticsearchException Index a document. Adds a JSON document to the specified data stream or index and makes it searchable. If the target is an index and the document already exists, the request updates the document and increments its version.- Throws:
IOExceptionElasticsearchException- See Also:
-
index
public final <TDocument> IndexResponse index(Function<IndexRequest.Builder<TDocument>, ObjectBuilder<IndexRequest<TDocument>>> fn) throws IOException, ElasticsearchExceptionIndex a document. Adds a JSON document to the specified data stream or index and makes it searchable. If the target is an index and the document already exists, the request updates the document and increments its version.- Parameters:
fn- a function that initializes a builder to create theIndexRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
info
Get cluster info. Returns basic information about the cluster.- Throws:
IOExceptionElasticsearchException- See Also:
-
knnSearch
public <TDocument> KnnSearchResponse<TDocument> knnSearch(KnnSearchRequest request, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException Run a knn search.NOTE: The kNN search API has been replaced by the
knnoption in the search API.Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents. Given a query vector, the API finds the k closest vectors and returns those documents as search hits.
Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed. This means the results returned are not always the true k closest neighbors.
The kNN search API supports restricting the search using a filter. The search will return the top k documents that also match the filter query.
- Throws:
IOExceptionElasticsearchException- See Also:
-
knnSearch
public final <TDocument> KnnSearchResponse<TDocument> knnSearch(Function<KnnSearchRequest.Builder, ObjectBuilder<KnnSearchRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchExceptionRun a knn search.NOTE: The kNN search API has been replaced by the
knnoption in the search API.Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents. Given a query vector, the API finds the k closest vectors and returns those documents as search hits.
Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed. This means the results returned are not always the true k closest neighbors.
The kNN search API supports restricting the search using a filter. The search will return the top k documents that also match the filter query.
- Parameters:
fn- a function that initializes a builder to create theKnnSearchRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
knnSearch
public <TDocument> KnnSearchResponse<TDocument> knnSearch(KnnSearchRequest request, Type tDocumentType) throws IOException, ElasticsearchException Run a knn search.NOTE: The kNN search API has been replaced by the
knnoption in the search API.Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents. Given a query vector, the API finds the k closest vectors and returns those documents as search hits.
Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed. This means the results returned are not always the true k closest neighbors.
The kNN search API supports restricting the search using a filter. The search will return the top k documents that also match the filter query.
- Throws:
IOExceptionElasticsearchException- See Also:
-
knnSearch
public final <TDocument> KnnSearchResponse<TDocument> knnSearch(Function<KnnSearchRequest.Builder, ObjectBuilder<KnnSearchRequest>> fn, Type tDocumentType) throws IOException, ElasticsearchExceptionRun a knn search.NOTE: The kNN search API has been replaced by the
knnoption in the search API.Perform a k-nearest neighbor (kNN) search on a dense_vector field and return the matching documents. Given a query vector, the API finds the k closest vectors and returns those documents as search hits.
Elasticsearch uses the HNSW algorithm to support efficient kNN search. Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved search speed. This means the results returned are not always the true k closest neighbors.
The kNN search API supports restricting the search using a filter. The search will return the top k documents that also match the filter query.
- Parameters:
fn- a function that initializes a builder to create theKnnSearchRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
mget
public <TDocument> MgetResponse<TDocument> mget(MgetRequest request, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException Get multiple documents.Get multiple JSON documents by ID from one or more indices. If you specify an index in the request URI, you only need to specify the document IDs in the request body. To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail.
- Throws:
IOExceptionElasticsearchException- See Also:
-
mget
public final <TDocument> MgetResponse<TDocument> mget(Function<MgetRequest.Builder, ObjectBuilder<MgetRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchExceptionGet multiple documents.Get multiple JSON documents by ID from one or more indices. If you specify an index in the request URI, you only need to specify the document IDs in the request body. To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail.
- Parameters:
fn- a function that initializes a builder to create theMgetRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
mget
public <TDocument> MgetResponse<TDocument> mget(MgetRequest request, Type tDocumentType) throws IOException, ElasticsearchException Get multiple documents.Get multiple JSON documents by ID from one or more indices. If you specify an index in the request URI, you only need to specify the document IDs in the request body. To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail.
- Throws:
IOExceptionElasticsearchException- See Also:
-
mget
public final <TDocument> MgetResponse<TDocument> mget(Function<MgetRequest.Builder, ObjectBuilder<MgetRequest>> fn, Type tDocumentType) throws IOException, ElasticsearchExceptionGet multiple documents.Get multiple JSON documents by ID from one or more indices. If you specify an index in the request URI, you only need to specify the document IDs in the request body. To ensure fast responses, this multi get (mget) API responds with partial results if one or more shards fail.
- Parameters:
fn- a function that initializes a builder to create theMgetRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
msearch
public <TDocument> MsearchResponse<TDocument> msearch(MsearchRequest request, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException Run multiple searches.The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. The structure is as follows:
header\n body\n header\n body\nThis structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.
IMPORTANT: The final line of data must end with a newline character
\n. Each newline character may be preceded by a carriage return\r. When sending requests to this endpoint theContent-Typeheader should be set toapplication/x-ndjson.- Throws:
IOExceptionElasticsearchException- See Also:
-
msearch
public final <TDocument> MsearchResponse<TDocument> msearch(Function<MsearchRequest.Builder, ObjectBuilder<MsearchRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchExceptionRun multiple searches.The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. The structure is as follows:
header\n body\n header\n body\nThis structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.
IMPORTANT: The final line of data must end with a newline character
\n. Each newline character may be preceded by a carriage return\r. When sending requests to this endpoint theContent-Typeheader should be set toapplication/x-ndjson.- Parameters:
fn- a function that initializes a builder to create theMsearchRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
msearch
public <TDocument> MsearchResponse<TDocument> msearch(MsearchRequest request, Type tDocumentType) throws IOException, ElasticsearchException Run multiple searches.The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. The structure is as follows:
header\n body\n header\n body\nThis structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.
IMPORTANT: The final line of data must end with a newline character
\n. Each newline character may be preceded by a carriage return\r. When sending requests to this endpoint theContent-Typeheader should be set toapplication/x-ndjson.- Throws:
IOExceptionElasticsearchException- See Also:
-
msearch
public final <TDocument> MsearchResponse<TDocument> msearch(Function<MsearchRequest.Builder, ObjectBuilder<MsearchRequest>> fn, Type tDocumentType) throws IOException, ElasticsearchExceptionRun multiple searches.The format of the request is similar to the bulk API format and makes use of the newline delimited JSON (NDJSON) format. The structure is as follows:
header\n body\n header\n body\nThis structure is specifically optimized to reduce parsing if a specific search ends up redirected to another node.
IMPORTANT: The final line of data must end with a newline character
\n. Each newline character may be preceded by a carriage return\r. When sending requests to this endpoint theContent-Typeheader should be set toapplication/x-ndjson.- Parameters:
fn- a function that initializes a builder to create theMsearchRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
msearchTemplate
public <TDocument> MsearchTemplateResponse<TDocument> msearchTemplate(MsearchTemplateRequest request, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException Run multiple templated searches.- Throws:
IOExceptionElasticsearchException- See Also:
-
msearchTemplate
public final <TDocument> MsearchTemplateResponse<TDocument> msearchTemplate(Function<MsearchTemplateRequest.Builder, ObjectBuilder<MsearchTemplateRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchExceptionRun multiple templated searches.- Parameters:
fn- a function that initializes a builder to create theMsearchTemplateRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
msearchTemplate
public <TDocument> MsearchTemplateResponse<TDocument> msearchTemplate(MsearchTemplateRequest request, Type tDocumentType) throws IOException, ElasticsearchException Run multiple templated searches.- Throws:
IOExceptionElasticsearchException- See Also:
-
msearchTemplate
public final <TDocument> MsearchTemplateResponse<TDocument> msearchTemplate(Function<MsearchTemplateRequest.Builder, ObjectBuilder<MsearchTemplateRequest>> fn, Type tDocumentType) throws IOException, ElasticsearchExceptionRun multiple templated searches.- Parameters:
fn- a function that initializes a builder to create theMsearchTemplateRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
mtermvectors
public MtermvectorsResponse mtermvectors(MtermvectorsRequest request) throws IOException, ElasticsearchException Get multiple term vectors.You can specify existing documents by index and ID or provide artificial documents in the body of the request. You can specify the index in the request body or request URI. The response contains a
docsarray with all the fetched termvectors. Each element has the structure provided by the termvectors API.- Throws:
IOExceptionElasticsearchException- See Also:
-
mtermvectors
public final MtermvectorsResponse mtermvectors(Function<MtermvectorsRequest.Builder, ObjectBuilder<MtermvectorsRequest>> fn) throws IOException, ElasticsearchExceptionGet multiple term vectors.You can specify existing documents by index and ID or provide artificial documents in the body of the request. You can specify the index in the request body or request URI. The response contains a
docsarray with all the fetched termvectors. Each element has the structure provided by the termvectors API.- Parameters:
fn- a function that initializes a builder to create theMtermvectorsRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
mtermvectors
Get multiple term vectors.You can specify existing documents by index and ID or provide artificial documents in the body of the request. You can specify the index in the request body or request URI. The response contains a
docsarray with all the fetched termvectors. Each element has the structure provided by the termvectors API.- Throws:
IOExceptionElasticsearchException- See Also:
-
openPointInTime
public OpenPointInTimeResponse openPointInTime(OpenPointInTimeRequest request) throws IOException, ElasticsearchException Open a point in time.A search request by default runs against the most recent visible data of the target indices, which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple search requests using the same point in time. For example, if refreshes happen between
search_afterrequests, then the results of those requests might not be consistent as changes happening between searches are only visible to the more recent point in time.A point in time must be opened explicitly before being used in search requests. The
keep_aliveparameter tells Elasticsearch how long it should persist.- Throws:
IOExceptionElasticsearchException- See Also:
-
openPointInTime
public final OpenPointInTimeResponse openPointInTime(Function<OpenPointInTimeRequest.Builder, ObjectBuilder<OpenPointInTimeRequest>> fn) throws IOException, ElasticsearchExceptionOpen a point in time.A search request by default runs against the most recent visible data of the target indices, which is called point in time. Elasticsearch pit (point in time) is a lightweight view into the state of the data as it existed when initiated. In some cases, it’s preferred to perform multiple search requests using the same point in time. For example, if refreshes happen between
search_afterrequests, then the results of those requests might not be consistent as changes happening between searches are only visible to the more recent point in time.A point in time must be opened explicitly before being used in search requests. The
keep_aliveparameter tells Elasticsearch how long it should persist.- Parameters:
fn- a function that initializes a builder to create theOpenPointInTimeRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
ping
Ping the cluster. Returns whether the cluster is running.- Throws:
IOExceptionElasticsearchException- See Also:
-
putScript
public PutScriptResponse putScript(PutScriptRequest request) throws IOException, ElasticsearchException Create or update a script or search template. Creates or updates a stored script or search template.- Throws:
IOExceptionElasticsearchException- See Also:
-
putScript
public final PutScriptResponse putScript(Function<PutScriptRequest.Builder, ObjectBuilder<PutScriptRequest>> fn) throws IOException, ElasticsearchExceptionCreate or update a script or search template. Creates or updates a stored script or search template.- Parameters:
fn- a function that initializes a builder to create thePutScriptRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
rankEval
public RankEvalResponse rankEval(RankEvalRequest request) throws IOException, ElasticsearchException Evaluate ranked search results.Evaluate the quality of ranked search results over a set of typical search queries.
- Throws:
IOExceptionElasticsearchException- See Also:
-
rankEval
public final RankEvalResponse rankEval(Function<RankEvalRequest.Builder, ObjectBuilder<RankEvalRequest>> fn) throws IOException, ElasticsearchExceptionEvaluate ranked search results.Evaluate the quality of ranked search results over a set of typical search queries.
- Parameters:
fn- a function that initializes a builder to create theRankEvalRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
reindex
Reindex documents. Copies documents from a source to a destination. The source can be any existing index, alias, or data stream. The destination must differ from the source. For example, you cannot reindex a data stream into itself.- Throws:
IOExceptionElasticsearchException- See Also:
-
reindex
public final ReindexResponse reindex(Function<ReindexRequest.Builder, ObjectBuilder<ReindexRequest>> fn) throws IOException, ElasticsearchExceptionReindex documents. Copies documents from a source to a destination. The source can be any existing index, alias, or data stream. The destination must differ from the source. For example, you cannot reindex a data stream into itself.- Parameters:
fn- a function that initializes a builder to create theReindexRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
reindexRethrottle
public ReindexRethrottleResponse reindexRethrottle(ReindexRethrottleRequest request) throws IOException, ElasticsearchException Throttle a reindex operation.Change the number of requests per second for a particular reindex operation.
- Throws:
IOExceptionElasticsearchException- See Also:
-
reindexRethrottle
public final ReindexRethrottleResponse reindexRethrottle(Function<ReindexRethrottleRequest.Builder, ObjectBuilder<ReindexRethrottleRequest>> fn) throws IOException, ElasticsearchExceptionThrottle a reindex operation.Change the number of requests per second for a particular reindex operation.
- Parameters:
fn- a function that initializes a builder to create theReindexRethrottleRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
renderSearchTemplate
public RenderSearchTemplateResponse renderSearchTemplate(RenderSearchTemplateRequest request) throws IOException, ElasticsearchException Render a search template.Render a search template as a search request body.
- Throws:
IOExceptionElasticsearchException- See Also:
-
renderSearchTemplate
public final RenderSearchTemplateResponse renderSearchTemplate(Function<RenderSearchTemplateRequest.Builder, ObjectBuilder<RenderSearchTemplateRequest>> fn) throws IOException, ElasticsearchExceptionRender a search template.Render a search template as a search request body.
- Parameters:
fn- a function that initializes a builder to create theRenderSearchTemplateRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
renderSearchTemplate
public RenderSearchTemplateResponse renderSearchTemplate() throws IOException, ElasticsearchExceptionRender a search template.Render a search template as a search request body.
- Throws:
IOExceptionElasticsearchException- See Also:
-
scriptsPainlessExecute
public <TResult> ScriptsPainlessExecuteResponse<TResult> scriptsPainlessExecute(ScriptsPainlessExecuteRequest request, Class<TResult> tResultClass) throws IOException, ElasticsearchException Run a script. Runs a script and returns a result.- Throws:
IOExceptionElasticsearchException- See Also:
-
scriptsPainlessExecute
public final <TResult> ScriptsPainlessExecuteResponse<TResult> scriptsPainlessExecute(Function<ScriptsPainlessExecuteRequest.Builder, ObjectBuilder<ScriptsPainlessExecuteRequest>> fn, Class<TResult> tResultClass) throws IOException, ElasticsearchExceptionRun a script. Runs a script and returns a result.- Parameters:
fn- a function that initializes a builder to create theScriptsPainlessExecuteRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
scriptsPainlessExecute
public <TResult> ScriptsPainlessExecuteResponse<TResult> scriptsPainlessExecute(ScriptsPainlessExecuteRequest request, Type tResultType) throws IOException, ElasticsearchException Run a script. Runs a script and returns a result.- Throws:
IOExceptionElasticsearchException- See Also:
-
scriptsPainlessExecute
public final <TResult> ScriptsPainlessExecuteResponse<TResult> scriptsPainlessExecute(Function<ScriptsPainlessExecuteRequest.Builder, ObjectBuilder<ScriptsPainlessExecuteRequest>> fn, Type tResultType) throws IOException, ElasticsearchExceptionRun a script. Runs a script and returns a result.- Parameters:
fn- a function that initializes a builder to create theScriptsPainlessExecuteRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
scroll
public <TDocument> ScrollResponse<TDocument> scroll(ScrollRequest request, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException Run a scrolling search.IMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the
search_afterparameter with a point in time (PIT).The scroll API gets large sets of results from a single scrolling search request. To get the necessary scroll ID, submit a search API request that includes an argument for the
scrollquery parameter. Thescrollparameter indicates how long Elasticsearch should retain the search context for the request. The search response returns a scroll ID in the_scroll_idresponse body parameter. You can then use the scroll ID with the scroll API to retrieve the next batch of results for the request. If the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search.You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context.
IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests.
- Throws:
IOExceptionElasticsearchException- See Also:
-
scroll
public final <TDocument> ScrollResponse<TDocument> scroll(Function<ScrollRequest.Builder, ObjectBuilder<ScrollRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchExceptionRun a scrolling search.IMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the
search_afterparameter with a point in time (PIT).The scroll API gets large sets of results from a single scrolling search request. To get the necessary scroll ID, submit a search API request that includes an argument for the
scrollquery parameter. Thescrollparameter indicates how long Elasticsearch should retain the search context for the request. The search response returns a scroll ID in the_scroll_idresponse body parameter. You can then use the scroll ID with the scroll API to retrieve the next batch of results for the request. If the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search.You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context.
IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests.
- Parameters:
fn- a function that initializes a builder to create theScrollRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
scroll
public <TDocument> ScrollResponse<TDocument> scroll(ScrollRequest request, Type tDocumentType) throws IOException, ElasticsearchException Run a scrolling search.IMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the
search_afterparameter with a point in time (PIT).The scroll API gets large sets of results from a single scrolling search request. To get the necessary scroll ID, submit a search API request that includes an argument for the
scrollquery parameter. Thescrollparameter indicates how long Elasticsearch should retain the search context for the request. The search response returns a scroll ID in the_scroll_idresponse body parameter. You can then use the scroll ID with the scroll API to retrieve the next batch of results for the request. If the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search.You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context.
IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests.
- Throws:
IOExceptionElasticsearchException- See Also:
-
scroll
public final <TDocument> ScrollResponse<TDocument> scroll(Function<ScrollRequest.Builder, ObjectBuilder<ScrollRequest>> fn, Type tDocumentType) throws IOException, ElasticsearchExceptionRun a scrolling search.IMPORTANT: The scroll API is no longer recommend for deep pagination. If you need to preserve the index state while paging through more than 10,000 hits, use the
search_afterparameter with a point in time (PIT).The scroll API gets large sets of results from a single scrolling search request. To get the necessary scroll ID, submit a search API request that includes an argument for the
scrollquery parameter. Thescrollparameter indicates how long Elasticsearch should retain the search context for the request. The search response returns a scroll ID in the_scroll_idresponse body parameter. You can then use the scroll ID with the scroll API to retrieve the next batch of results for the request. If the Elasticsearch security features are enabled, the access to the results of a specific scroll ID is restricted to the user or API key that submitted the search.You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context.
IMPORTANT: Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests.
- Parameters:
fn- a function that initializes a builder to create theScrollRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
search
public <TDocument> SearchResponse<TDocument> search(SearchRequest request, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException Run a search.Get search hits that match the query defined in the request. You can provide search queries using the
qquery string parameter or the request body. If both are specified, only the query parameter is used.- Throws:
IOExceptionElasticsearchException- See Also:
-
search
public final <TDocument> SearchResponse<TDocument> search(Function<SearchRequest.Builder, ObjectBuilder<SearchRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchExceptionRun a search.Get search hits that match the query defined in the request. You can provide search queries using the
qquery string parameter or the request body. If both are specified, only the query parameter is used.- Parameters:
fn- a function that initializes a builder to create theSearchRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
search
public <TDocument> SearchResponse<TDocument> search(SearchRequest request, Type tDocumentType) throws IOException, ElasticsearchException Run a search.Get search hits that match the query defined in the request. You can provide search queries using the
qquery string parameter or the request body. If both are specified, only the query parameter is used.- Throws:
IOExceptionElasticsearchException- See Also:
-
search
public final <TDocument> SearchResponse<TDocument> search(Function<SearchRequest.Builder, ObjectBuilder<SearchRequest>> fn, Type tDocumentType) throws IOException, ElasticsearchExceptionRun a search.Get search hits that match the query defined in the request. You can provide search queries using the
qquery string parameter or the request body. If both are specified, only the query parameter is used.- Parameters:
fn- a function that initializes a builder to create theSearchRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
searchMvt
public BinaryResponse searchMvt(SearchMvtRequest request) throws IOException, ElasticsearchException Search a vector tile.Search a vector tile for geospatial values.
- Throws:
IOExceptionElasticsearchException- See Also:
-
searchMvt
public final BinaryResponse searchMvt(Function<SearchMvtRequest.Builder, ObjectBuilder<SearchMvtRequest>> fn) throws IOException, ElasticsearchExceptionSearch a vector tile.Search a vector tile for geospatial values.
- Parameters:
fn- a function that initializes a builder to create theSearchMvtRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
searchShards
public SearchShardsResponse searchShards(SearchShardsRequest request) throws IOException, ElasticsearchException Get the search shards.Get the indices and shards that a search request would be run against. This information can be useful for working out issues or planning optimizations with routing and shard preferences. When filtered aliases are used, the filter is returned as part of the indices section.
- Throws:
IOExceptionElasticsearchException- See Also:
-
searchShards
public final SearchShardsResponse searchShards(Function<SearchShardsRequest.Builder, ObjectBuilder<SearchShardsRequest>> fn) throws IOException, ElasticsearchExceptionGet the search shards.Get the indices and shards that a search request would be run against. This information can be useful for working out issues or planning optimizations with routing and shard preferences. When filtered aliases are used, the filter is returned as part of the indices section.
- Parameters:
fn- a function that initializes a builder to create theSearchShardsRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
searchShards
Get the search shards.Get the indices and shards that a search request would be run against. This information can be useful for working out issues or planning optimizations with routing and shard preferences. When filtered aliases are used, the filter is returned as part of the indices section.
- Throws:
IOExceptionElasticsearchException- See Also:
-
searchTemplate
public <TDocument> SearchTemplateResponse<TDocument> searchTemplate(SearchTemplateRequest request, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchException Run a search with a search template.- Throws:
IOExceptionElasticsearchException- See Also:
-
searchTemplate
public final <TDocument> SearchTemplateResponse<TDocument> searchTemplate(Function<SearchTemplateRequest.Builder, ObjectBuilder<SearchTemplateRequest>> fn, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchExceptionRun a search with a search template.- Parameters:
fn- a function that initializes a builder to create theSearchTemplateRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
searchTemplate
public <TDocument> SearchTemplateResponse<TDocument> searchTemplate(SearchTemplateRequest request, Type tDocumentType) throws IOException, ElasticsearchException Run a search with a search template.- Throws:
IOExceptionElasticsearchException- See Also:
-
searchTemplate
public final <TDocument> SearchTemplateResponse<TDocument> searchTemplate(Function<SearchTemplateRequest.Builder, ObjectBuilder<SearchTemplateRequest>> fn, Type tDocumentType) throws IOException, ElasticsearchExceptionRun a search with a search template.- Parameters:
fn- a function that initializes a builder to create theSearchTemplateRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
termsEnum
public TermsEnumResponse termsEnum(TermsEnumRequest request) throws IOException, ElasticsearchException Get terms in an index.Discover terms that match a partial string in an index. This "terms enum" API is designed for low-latency look-ups used in auto-complete scenarios.
If the
completeproperty in the response is false, the returned terms set may be incomplete and should be treated as approximate. This can occur due to a few reasons, such as a request timeout or a node error.NOTE: The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents.
- Throws:
IOExceptionElasticsearchException- See Also:
-
termsEnum
public final TermsEnumResponse termsEnum(Function<TermsEnumRequest.Builder, ObjectBuilder<TermsEnumRequest>> fn) throws IOException, ElasticsearchExceptionGet terms in an index.Discover terms that match a partial string in an index. This "terms enum" API is designed for low-latency look-ups used in auto-complete scenarios.
If the
completeproperty in the response is false, the returned terms set may be incomplete and should be treated as approximate. This can occur due to a few reasons, such as a request timeout or a node error.NOTE: The terms enum API may return terms from deleted documents. Deleted documents are initially only marked as deleted. It is not until their segments are merged that documents are actually deleted. Until that happens, the terms enum API will return terms from these documents.
- Parameters:
fn- a function that initializes a builder to create theTermsEnumRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
termvectors
public <TDocument> TermvectorsResponse termvectors(TermvectorsRequest<TDocument> request) throws IOException, ElasticsearchException Get term vector information.Get information and statistics about terms in the fields of a particular document.
- Throws:
IOExceptionElasticsearchException- See Also:
-
termvectors
public final <TDocument> TermvectorsResponse termvectors(Function<TermvectorsRequest.Builder<TDocument>, ObjectBuilder<TermvectorsRequest<TDocument>>> fn) throws IOException, ElasticsearchExceptionGet term vector information.Get information and statistics about terms in the fields of a particular document.
- Parameters:
fn- a function that initializes a builder to create theTermvectorsRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
update
public <TDocument,TPartialDocument> UpdateResponse<TDocument> update(UpdateRequest<TDocument, TPartialDocument> request, Class<TDocument> tDocumentClass) throws IOException, ElasticsearchExceptionUpdate a document. Updates a document by running a script or passing a partial document.- Throws:
IOExceptionElasticsearchException- See Also:
-
update
public final <TDocument,TPartialDocument> UpdateResponse<TDocument> update(Function<UpdateRequest.Builder<TDocument, TPartialDocument>, throws IOException, ElasticsearchExceptionObjectBuilder<UpdateRequest<TDocument, TPartialDocument>>> fn, Class<TDocument> tDocumentClass) Update a document. Updates a document by running a script or passing a partial document.- Parameters:
fn- a function that initializes a builder to create theUpdateRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
update
public <TDocument,TPartialDocument> UpdateResponse<TDocument> update(UpdateRequest<TDocument, TPartialDocument> request, Type tDocumentType) throws IOException, ElasticsearchExceptionUpdate a document. Updates a document by running a script or passing a partial document.- Throws:
IOExceptionElasticsearchException- See Also:
-
update
public final <TDocument,TPartialDocument> UpdateResponse<TDocument> update(Function<UpdateRequest.Builder<TDocument, TPartialDocument>, throws IOException, ElasticsearchExceptionObjectBuilder<UpdateRequest<TDocument, TPartialDocument>>> fn, Type tDocumentType) Update a document. Updates a document by running a script or passing a partial document.- Parameters:
fn- a function that initializes a builder to create theUpdateRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
updateByQuery
public UpdateByQueryResponse updateByQuery(UpdateByQueryRequest request) throws IOException, ElasticsearchException Update documents. Updates documents that match the specified query. If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes.- Throws:
IOExceptionElasticsearchException- See Also:
-
updateByQuery
public final UpdateByQueryResponse updateByQuery(Function<UpdateByQueryRequest.Builder, ObjectBuilder<UpdateByQueryRequest>> fn) throws IOException, ElasticsearchExceptionUpdate documents. Updates documents that match the specified query. If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes.- Parameters:
fn- a function that initializes a builder to create theUpdateByQueryRequest- Throws:
IOExceptionElasticsearchException- See Also:
-
updateByQueryRethrottle
public UpdateByQueryRethrottleResponse updateByQueryRethrottle(UpdateByQueryRethrottleRequest request) throws IOException, ElasticsearchException Throttle an update by query operation.Change the number of requests per second for a particular update by query operation. Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.
- Throws:
IOExceptionElasticsearchException- See Also:
-
updateByQueryRethrottle
public final UpdateByQueryRethrottleResponse updateByQueryRethrottle(Function<UpdateByQueryRethrottleRequest.Builder, ObjectBuilder<UpdateByQueryRethrottleRequest>> fn) throws IOException, ElasticsearchExceptionThrottle an update by query operation.Change the number of requests per second for a particular update by query operation. Rethrottling that speeds up the query takes effect immediately but rethrotting that slows down the query takes effect after completing the current batch to prevent scroll timeouts.
- Parameters:
fn- a function that initializes a builder to create theUpdateByQueryRethrottleRequest- Throws:
IOExceptionElasticsearchException- See Also:
-