Package org.elasticsearch.client
Interface Client
- All Superinterfaces:
AutoCloseable
,Closeable
,ElasticsearchClient
,org.elasticsearch.core.Releasable
- All Known Implementing Classes:
AbstractClient
,FilterClient
,NodeClient
,OriginSettingClient
,ParentTaskAssigningClient
,RestCancellableNodeClient
,TransportClient
A client provides a one stop interface for performing actions/operations against the cluster.
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
.
- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionadmin()
The admin client that can be used to perform administrative operations.bulk
(BulkRequest request) Executes a bulk of index / delete operations.void
bulk
(BulkRequest request, ActionListener<BulkResponse> listener) Executes a bulk of index / delete operations.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.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.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.fieldCaps
(FieldCapabilitiesRequest request) An action that returns the field capabilities from the provided requestvoid
fieldCaps
(FieldCapabilitiesRequest request, ActionListener<FieldCapabilitiesResponse> listener) An action that returns the field capabilities from the provided requestfilterWithHeader
(Map<String, String> headers) Returns a new lightweight Client that applies all given headers to each of the requests issued from it.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.default Client
getRemoteClusterClient
(String clusterAlias) Returns a client to a remote cluster with the given cluster alias.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.multiGet
(MultiGetRequest request) Multi get documents.void
multiGet
(MultiGetRequest request, ActionListener<MultiGetResponse> listener) Multi get documents.multiSearch
(MultiSearchRequest request) Performs multiple search requests.void
multiSearch
(MultiSearchRequest request, ActionListener<MultiSearchResponse> listener) Performs multiple search requests.multiTermVectors
(MultiTermVectorsRequest request) Multi get term vectors.void
multiTermVectors
(MultiTermVectorsRequest request, ActionListener<MultiTermVectorsResponse> listener) Multi get term vectors.Executes a bulk of index / delete operations.prepareBulk
(String globalIndex, String globalType) Executes a bulk of index / delete operations with default index and/or typeClears the search contexts associated with specified scroll ids.Deletes a document from the index based on the index, type and id.prepareDelete
(String index, String type, String id) Deletes a document from the index based on the index, type and id.prepareExplain
(String index, String type, String id) Computes a score explanation for the specified request.prepareFieldCaps
(String... indices) Builder for the field capabilities request.Gets the document that was indexed from an index with a type and id.prepareGet
(String index, String type, String id) Gets the document that was indexed from an index with a type (optional) and id.Index a document associated with a given index and type.prepareIndex
(String index, String type) Index a document associated with a given index and type.prepareIndex
(String index, String type, String id) Index a document associated with a given index and type.Multi get documents.Performs multiple search requests.Multi get term vectors.prepareSearch
(String... indices) Search across one or more indices and one or more types with a query.prepareSearchScroll
(String scrollId) A search scroll request to continue searching a previous scrollable search request.Builder for the term vector request.prepareTermVectors
(String index, String type, String id) Builder for the term vector request.Updates a document based on a script.prepareUpdate
(String index, String type, String id) Updates a document based on a script.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.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()
Returns this clients settingstermVectors
(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.update
(UpdateRequest request) Updates a document based on a script.void
update
(UpdateRequest request, ActionListener<UpdateResponse> listener) Updates a document based on a script.Methods inherited from interface org.elasticsearch.client.ElasticsearchClient
execute, execute, threadPool
Methods inherited from interface org.elasticsearch.core.Releasable
close
-
Field Details
-
CLIENT_TYPE_SETTING_S
-
-
Method Details
-
admin
AdminClient admin()The admin client that can be used to perform administrative operations. -
index
Index a JSON source associated with a given index and type.The id is optional, if it is not provided, one will be generated automatically.
- Parameters:
request
- The index request- Returns:
- The result future
- See Also:
-
index
Index a document associated with a given index and type.The id is optional, if it is not provided, one will be generated automatically.
- Parameters:
request
- The index requestlistener
- A listener to be notified with a result- See Also:
-
prepareIndex
IndexRequestBuilder prepareIndex()Index a document associated with a given index and type.The id is optional, if it is not provided, one will be generated automatically.
-
update
Updates a document based on a script.- Parameters:
request
- The update request- Returns:
- The result future
-
update
Updates a document based on a script.- Parameters:
request
- The update requestlistener
- A listener to be notified with a result
-
prepareUpdate
UpdateRequestBuilder prepareUpdate()Updates a document based on a script. -
prepareUpdate
Updates a document based on a script. -
prepareIndex
Index a document associated with a given index and type.The id is optional, if it is not provided, one will be generated automatically.
- Parameters:
index
- The index to index the document totype
- The type to index the document to
-
prepareIndex
Index a document associated with a given index and type.The id is optional, if it is not provided, one will be generated automatically.
- Parameters:
index
- The index to index the document totype
- The type to index the document toid
- The id of the document
-
delete
Deletes a document from the index based on the index, type and id.- Parameters:
request
- The delete request- Returns:
- The result future
- See Also:
-
delete
Deletes a document from the index based on the index, type and id.- Parameters:
request
- The delete requestlistener
- A listener to be notified with a result- See Also:
-
prepareDelete
DeleteRequestBuilder prepareDelete()Deletes a document from the index based on the index, type and id. -
prepareDelete
Deletes a document from the index based on the index, type and id.- Parameters:
index
- The index to delete the document fromtype
- The type of the document to deleteid
- The id of the document to delete
-
bulk
Executes a bulk of index / delete operations.- Parameters:
request
- The bulk request- Returns:
- The result future
- See Also:
-
bulk
Executes a bulk of index / delete operations.- Parameters:
request
- The bulk requestlistener
- A listener to be notified with a result- See Also:
-
prepareBulk
BulkRequestBuilder prepareBulk()Executes a bulk of index / delete operations. -
prepareBulk
Executes a bulk of index / delete operations with default index and/or type -
get
Gets the document that was indexed from an index with a type and id.- Parameters:
request
- The get request- Returns:
- The result future
- See Also:
-
get
Gets the document that was indexed from an index with a type and id.- Parameters:
request
- The get requestlistener
- A listener to be notified with a result- See Also:
-
prepareGet
GetRequestBuilder prepareGet()Gets the document that was indexed from an index with a type and id. -
prepareGet
Gets the document that was indexed from an index with a type (optional) and id. -
multiGet
Multi get documents. -
multiGet
Multi get documents. -
prepareMultiGet
MultiGetRequestBuilder prepareMultiGet()Multi get documents. -
search
Search across one or more indices and one or more types with a query.- Parameters:
request
- The search request- Returns:
- The result future
- See Also:
-
search
Search across one or more indices and one or more types with a query.- Parameters:
request
- The search requestlistener
- A listener to be notified of the result- See Also:
-
prepareSearch
Search across one or more indices and one or more types with a query. -
searchScroll
A search scroll request to continue searching a previous scrollable search request.- Parameters:
request
- The search scroll request- Returns:
- The result future
- See Also:
-
searchScroll
A search scroll request to continue searching a previous scrollable search request.- Parameters:
request
- The search scroll requestlistener
- A listener to be notified of the result- See Also:
-
prepareSearchScroll
A search scroll request to continue searching a previous scrollable search request. -
multiSearch
Performs multiple search requests. -
multiSearch
Performs multiple search requests. -
prepareMultiSearch
MultiSearchRequestBuilder prepareMultiSearch()Performs multiple search requests. -
termVectors
An action that returns the term vectors for a specific document.- Parameters:
request
- The term vector request- Returns:
- The response future
-
termVectors
An action that returns the term vectors for a specific document.- Parameters:
request
- The term vector request
-
prepareTermVectors
TermVectorsRequestBuilder prepareTermVectors()Builder for the term vector request. -
prepareTermVectors
Builder for the term vector request.- Parameters:
index
- The index to load the document fromtype
- The type of the documentid
- The id of the document
-
multiTermVectors
Multi get term vectors. -
multiTermVectors
void multiTermVectors(MultiTermVectorsRequest request, ActionListener<MultiTermVectorsResponse> listener) Multi get term vectors. -
prepareMultiTermVectors
MultiTermVectorsRequestBuilder prepareMultiTermVectors()Multi get term vectors. -
prepareExplain
Computes a score explanation for the specified request.- Parameters:
index
- The index this explain is targeted fortype
- The type this explain is targeted forid
- The document identifier this explain is targeted for
-
explain
Computes a score explanation for the specified request.- Parameters:
request
- The request encapsulating the query and document identifier to compute a score explanation for
-
explain
Computes a score explanation for the specified request.- Parameters:
request
- The request encapsulating the query and document identifier to compute a score explanation forlistener
- A listener to be notified of the result
-
prepareClearScroll
ClearScrollRequestBuilder prepareClearScroll()Clears the search contexts associated with specified scroll ids. -
clearScroll
Clears the search contexts associated with specified scroll ids. -
clearScroll
Clears the search contexts associated with specified scroll ids. -
prepareFieldCaps
Builder for the field capabilities request. -
fieldCaps
An action that returns the field capabilities from the provided request -
fieldCaps
void fieldCaps(FieldCapabilitiesRequest request, ActionListener<FieldCapabilitiesResponse> listener) An action that returns the field capabilities from the provided request -
settings
Settings settings()Returns this clients settings -
filterWithHeader
Returns a new lightweight Client that applies all given headers to each of the requests issued from it. -
getRemoteClusterClient
Returns a client to a remote cluster with the given cluster alias.- Throws:
IllegalArgumentException
- if the given clusterAlias doesn't existUnsupportedOperationException
- if this functionality is not available on this client.
-