public interface Client extends ElasticsearchClient, Releasable
All operations performed are asynchronous by nature. Each action/operation has two flavors, the first
simply returns an ActionFuture
, while the second accepts an
ActionListener
.
A client can either be retrieved from a Node
started, or connected remotely
to one or more nodes using TransportClient
.
Node.client()
,
TransportClient
Modifier and Type | Field and Description |
---|---|
static Setting<java.lang.String> |
CLIENT_TYPE_SETTING_S |
Modifier and Type | Method and Description |
---|---|
AdminClient |
admin()
The admin client that can be used to perform administrative operations.
|
ActionFuture<BulkResponse> |
bulk(BulkRequest request)
Executes a bulk of index / delete operations.
|
void |
bulk(BulkRequest request,
ActionListener<BulkResponse> listener)
Executes a bulk of index / delete operations.
|
ActionFuture<ClearScrollResponse> |
clearScroll(ClearScrollRequest request)
Clears the search contexts associated with specified scroll ids.
|
void |
clearScroll(ClearScrollRequest request,
ActionListener<ClearScrollResponse> listener)
Clears the search contexts associated with specified scroll ids.
|
ActionFuture<DeleteResponse> |
delete(DeleteRequest request)
Deletes a document from the index based on the index, type and id.
|
void |
delete(DeleteRequest request,
ActionListener<DeleteResponse> listener)
Deletes a document from the index based on the index, type and id.
|
ActionFuture<ExplainResponse> |
explain(ExplainRequest request)
Computes a score explanation for the specified request.
|
void |
explain(ExplainRequest request,
ActionListener<ExplainResponse> listener)
Computes a score explanation for the specified request.
|
ActionFuture<FieldCapabilitiesResponse> |
fieldCaps(FieldCapabilitiesRequest request)
An action that returns the field capabilities from the provided request
|
void |
fieldCaps(FieldCapabilitiesRequest request,
ActionListener<FieldCapabilitiesResponse> listener)
An action that returns the field capabilities from the provided request
|
ActionFuture<FieldStatsResponse> |
fieldStats(FieldStatsRequest request)
Deprecated.
Use _field_caps instead or run a min/max aggregations on the desired fields
|
void |
fieldStats(FieldStatsRequest request,
ActionListener<FieldStatsResponse> listener)
Deprecated.
Use _field_caps instead or run a min/max aggregations on the desired fields
|
Client |
filterWithHeader(java.util.Map<java.lang.String,java.lang.String> headers)
Returns a new lightweight Client that applies all given headers to each of the requests
issued from it.
|
ActionFuture<GetResponse> |
get(GetRequest request)
Gets the document that was indexed from an index with a type and id.
|
void |
get(GetRequest request,
ActionListener<GetResponse> listener)
Gets the document that was indexed from an index with a type and id.
|
ActionFuture<IndexResponse> |
index(IndexRequest request)
Index a JSON source associated with a given index and type.
|
void |
index(IndexRequest request,
ActionListener<IndexResponse> listener)
Index a document associated with a given index and type.
|
ActionFuture<MultiGetResponse> |
multiGet(MultiGetRequest request)
Multi get documents.
|
void |
multiGet(MultiGetRequest request,
ActionListener<MultiGetResponse> listener)
Multi get documents.
|
ActionFuture<MultiSearchResponse> |
multiSearch(MultiSearchRequest request)
Performs multiple search requests.
|
void |
multiSearch(MultiSearchRequest request,
ActionListener<MultiSearchResponse> listener)
Performs multiple search requests.
|
ActionFuture<MultiTermVectorsResponse> |
multiTermVectors(MultiTermVectorsRequest request)
Multi get term vectors.
|
void |
multiTermVectors(MultiTermVectorsRequest request,
ActionListener<MultiTermVectorsResponse> listener)
Multi get term vectors.
|
BulkRequestBuilder |
prepareBulk()
Executes a bulk of index / delete operations.
|
ClearScrollRequestBuilder |
prepareClearScroll()
Clears the search contexts associated with specified scroll ids.
|
DeleteRequestBuilder |
prepareDelete()
Deletes a document from the index based on the index, type and id.
|
DeleteRequestBuilder |
prepareDelete(java.lang.String index,
java.lang.String type,
java.lang.String id)
Deletes a document from the index based on the index, type and id.
|
ExplainRequestBuilder |
prepareExplain(java.lang.String index,
java.lang.String type,
java.lang.String id)
Computes a score explanation for the specified request.
|
FieldCapabilitiesRequestBuilder |
prepareFieldCaps()
Builder for the field capabilities request.
|
FieldStatsRequestBuilder |
prepareFieldStats()
Deprecated.
Use _field_caps instead or run a min/max aggregations on the desired fields
|
GetRequestBuilder |
prepareGet()
Gets the document that was indexed from an index with a type and id.
|
GetRequestBuilder |
prepareGet(java.lang.String index,
java.lang.String type,
java.lang.String id)
Gets the document that was indexed from an index with a type (optional) and id.
|
IndexRequestBuilder |
prepareIndex()
Index a document associated with a given index and type.
|
IndexRequestBuilder |
prepareIndex(java.lang.String index,
java.lang.String type)
Index a document associated with a given index and type.
|
IndexRequestBuilder |
prepareIndex(java.lang.String index,
java.lang.String type,
java.lang.String id)
Index a document associated with a given index and type.
|
MultiGetRequestBuilder |
prepareMultiGet()
Multi get documents.
|
MultiSearchRequestBuilder |
prepareMultiSearch()
Performs multiple search requests.
|
MultiTermVectorsRequestBuilder |
prepareMultiTermVectors()
Multi get term vectors.
|
SearchRequestBuilder |
prepareSearch(java.lang.String... indices)
Search across one or more indices and one or more types with a query.
|
SearchScrollRequestBuilder |
prepareSearchScroll(java.lang.String scrollId)
A search scroll request to continue searching a previous scrollable search request.
|
TermVectorsRequestBuilder |
prepareTermVector()
Deprecated.
|
TermVectorsRequestBuilder |
prepareTermVector(java.lang.String index,
java.lang.String type,
java.lang.String id)
Deprecated.
|
TermVectorsRequestBuilder |
prepareTermVectors()
Builder for the term vector request.
|
TermVectorsRequestBuilder |
prepareTermVectors(java.lang.String index,
java.lang.String type,
java.lang.String id)
Builder for the term vector request.
|
UpdateRequestBuilder |
prepareUpdate()
Updates a document based on a script.
|
UpdateRequestBuilder |
prepareUpdate(java.lang.String index,
java.lang.String type,
java.lang.String id)
Updates a document based on a script.
|
ActionFuture<SearchResponse> |
search(SearchRequest request)
Search across one or more indices and one or more types with a query.
|
void |
search(SearchRequest request,
ActionListener<SearchResponse> listener)
Search across one or more indices and one or more types with a query.
|
ActionFuture<SearchResponse> |
searchScroll(SearchScrollRequest request)
A search scroll request to continue searching a previous scrollable search request.
|
void |
searchScroll(SearchScrollRequest request,
ActionListener<SearchResponse> listener)
A search scroll request to continue searching a previous scrollable search request.
|
Settings |
settings()
Returns this clients settings
|
ActionFuture<TermVectorsResponse> |
termVector(TermVectorsRequest request)
Deprecated.
|
void |
termVector(TermVectorsRequest request,
ActionListener<TermVectorsResponse> listener)
Deprecated.
|
ActionFuture<TermVectorsResponse> |
termVectors(TermVectorsRequest request)
An action that returns the term vectors for a specific document.
|
void |
termVectors(TermVectorsRequest request,
ActionListener<TermVectorsResponse> listener)
An action that returns the term vectors for a specific document.
|
ActionFuture<UpdateResponse> |
update(UpdateRequest request)
Updates a document based on a script.
|
void |
update(UpdateRequest request,
ActionListener<UpdateResponse> listener)
Updates a document based on a script.
|
execute, execute, prepareExecute, threadPool
close
static final Setting<java.lang.String> CLIENT_TYPE_SETTING_S
AdminClient admin()
ActionFuture<IndexResponse> index(IndexRequest request)
The id is optional, if it is not provided, one will be generated automatically.
request
- The index requestRequests.indexRequest(String)
void index(IndexRequest request, ActionListener<IndexResponse> listener)
The id is optional, if it is not provided, one will be generated automatically.
request
- The index requestlistener
- A listener to be notified with a resultRequests.indexRequest(String)
IndexRequestBuilder prepareIndex()
The id is optional, if it is not provided, one will be generated automatically.
ActionFuture<UpdateResponse> update(UpdateRequest request)
request
- The update requestvoid update(UpdateRequest request, ActionListener<UpdateResponse> listener)
request
- The update requestlistener
- A listener to be notified with a resultUpdateRequestBuilder prepareUpdate()
UpdateRequestBuilder prepareUpdate(java.lang.String index, java.lang.String type, java.lang.String id)
IndexRequestBuilder prepareIndex(java.lang.String index, java.lang.String type)
The id is optional, if it is not provided, one will be generated automatically.
index
- The index to index the document totype
- The type to index the document toIndexRequestBuilder prepareIndex(java.lang.String index, java.lang.String type, @Nullable java.lang.String id)
The id is optional, if it is not provided, one will be generated automatically.
index
- The index to index the document totype
- The type to index the document toid
- The id of the documentActionFuture<DeleteResponse> delete(DeleteRequest request)
request
- The delete requestRequests.deleteRequest(String)
void delete(DeleteRequest request, ActionListener<DeleteResponse> listener)
request
- The delete requestlistener
- A listener to be notified with a resultRequests.deleteRequest(String)
DeleteRequestBuilder prepareDelete()
DeleteRequestBuilder prepareDelete(java.lang.String index, java.lang.String type, java.lang.String id)
index
- The index to delete the document fromtype
- The type of the document to deleteid
- The id of the document to deleteActionFuture<BulkResponse> bulk(BulkRequest request)
request
- The bulk requestRequests.bulkRequest()
void bulk(BulkRequest request, ActionListener<BulkResponse> listener)
request
- The bulk requestlistener
- A listener to be notified with a resultRequests.bulkRequest()
BulkRequestBuilder prepareBulk()
ActionFuture<GetResponse> get(GetRequest request)
request
- The get requestRequests.getRequest(String)
void get(GetRequest request, ActionListener<GetResponse> listener)
request
- The get requestlistener
- A listener to be notified with a resultRequests.getRequest(String)
GetRequestBuilder prepareGet()
GetRequestBuilder prepareGet(java.lang.String index, @Nullable java.lang.String type, java.lang.String id)
ActionFuture<MultiGetResponse> multiGet(MultiGetRequest request)
void multiGet(MultiGetRequest request, ActionListener<MultiGetResponse> listener)
MultiGetRequestBuilder prepareMultiGet()
ActionFuture<SearchResponse> search(SearchRequest request)
request
- The search requestRequests.searchRequest(String...)
void search(SearchRequest request, ActionListener<SearchResponse> listener)
request
- The search requestlistener
- A listener to be notified of the resultRequests.searchRequest(String...)
SearchRequestBuilder prepareSearch(java.lang.String... indices)
ActionFuture<SearchResponse> searchScroll(SearchScrollRequest request)
request
- The search scroll requestRequests.searchScrollRequest(String)
void searchScroll(SearchScrollRequest request, ActionListener<SearchResponse> listener)
request
- The search scroll requestlistener
- A listener to be notified of the resultRequests.searchScrollRequest(String)
SearchScrollRequestBuilder prepareSearchScroll(java.lang.String scrollId)
ActionFuture<MultiSearchResponse> multiSearch(MultiSearchRequest request)
void multiSearch(MultiSearchRequest request, ActionListener<MultiSearchResponse> listener)
MultiSearchRequestBuilder prepareMultiSearch()
ActionFuture<TermVectorsResponse> termVectors(TermVectorsRequest request)
request
- The term vector requestvoid termVectors(TermVectorsRequest request, ActionListener<TermVectorsResponse> listener)
request
- The term vector requestTermVectorsRequestBuilder prepareTermVectors()
TermVectorsRequestBuilder prepareTermVectors(java.lang.String index, java.lang.String type, java.lang.String id)
index
- The index to load the document fromtype
- The type of the documentid
- The id of the document@Deprecated ActionFuture<TermVectorsResponse> termVector(TermVectorsRequest request)
request
- The term vector request@Deprecated void termVector(TermVectorsRequest request, ActionListener<TermVectorsResponse> listener)
request
- The term vector request@Deprecated TermVectorsRequestBuilder prepareTermVector()
@Deprecated TermVectorsRequestBuilder prepareTermVector(java.lang.String index, java.lang.String type, java.lang.String id)
index
- The index to load the document fromtype
- The type of the documentid
- The id of the documentActionFuture<MultiTermVectorsResponse> multiTermVectors(MultiTermVectorsRequest request)
void multiTermVectors(MultiTermVectorsRequest request, ActionListener<MultiTermVectorsResponse> listener)
MultiTermVectorsRequestBuilder prepareMultiTermVectors()
ExplainRequestBuilder prepareExplain(java.lang.String index, java.lang.String type, java.lang.String id)
index
- The index this explain is targeted fortype
- The type this explain is targeted forid
- The document identifier this explain is targeted forActionFuture<ExplainResponse> explain(ExplainRequest request)
request
- The request encapsulating the query and document identifier to compute a score explanation forvoid explain(ExplainRequest request, ActionListener<ExplainResponse> listener)
request
- The request encapsulating the query and document identifier to compute a score explanation forlistener
- A listener to be notified of the resultClearScrollRequestBuilder prepareClearScroll()
ActionFuture<ClearScrollResponse> clearScroll(ClearScrollRequest request)
void clearScroll(ClearScrollRequest request, ActionListener<ClearScrollResponse> listener)
@Deprecated FieldStatsRequestBuilder prepareFieldStats()
@Deprecated ActionFuture<FieldStatsResponse> fieldStats(FieldStatsRequest request)
@Deprecated void fieldStats(FieldStatsRequest request, ActionListener<FieldStatsResponse> listener)
FieldCapabilitiesRequestBuilder prepareFieldCaps()
ActionFuture<FieldCapabilitiesResponse> fieldCaps(FieldCapabilitiesRequest request)
void fieldCaps(FieldCapabilitiesRequest request, ActionListener<FieldCapabilitiesResponse> listener)
Settings settings()
Client filterWithHeader(java.util.Map<java.lang.String,java.lang.String> headers)