|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Client
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
.
Node.client()
,
TransportClient
Method Summary | ||
---|---|---|
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. |
|
void |
close()
Closes the client. |
|
ActionFuture<CountResponse> |
count(CountRequest request)
A count of all the documents matching a specific query. |
|
void |
count(CountRequest request,
ActionListener<CountResponse> listener)
A count of all the documents matching a specific query. |
|
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<DeleteByQueryResponse> |
deleteByQuery(DeleteByQueryRequest request)
Deletes all documents from one or more indices based on a query. |
|
void |
deleteByQuery(DeleteByQueryRequest request,
ActionListener<DeleteByQueryResponse> listener)
Deletes all documents from one or more indices based on a query. |
|
|
execute(Action<Request,Response,RequestBuilder> action,
Request request)
Executes a generic action, denoted by an Action . |
|
|
execute(Action<Request,Response,RequestBuilder> action,
Request request,
ActionListener<Response> listener)
Executes a generic action, denoted by an Action . |
|
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<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<SearchResponse> |
moreLikeThis(MoreLikeThisRequest request)
A more like this action to search for documents that are "like" a specific document. |
|
void |
moreLikeThis(MoreLikeThisRequest request,
ActionListener<SearchResponse> listener)
A more like this action to search for documents that are "like" a specific document. |
|
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<PercolateResponse> |
percolate(PercolateRequest request)
Percolates a request returning the matches documents. |
|
void |
percolate(PercolateRequest request,
ActionListener<PercolateResponse> listener)
Percolates a request returning the matches documents. |
|
BulkRequestBuilder |
prepareBulk()
Executes a bulk of index / delete operations. |
|
CountRequestBuilder |
prepareCount(String... indices)
A count of all the documents matching a specific query. |
|
DeleteRequestBuilder |
prepareDelete()
Deletes a document from the index based on the index, type and id. |
|
DeleteRequestBuilder |
prepareDelete(String index,
String type,
String id)
Deletes a document from the index based on the index, type and id. |
|
DeleteByQueryRequestBuilder |
prepareDeleteByQuery(String... indices)
Deletes all documents from one or more indices based on a query. |
|
|
prepareExecute(Action<Request,Response,RequestBuilder> action)
Prepares a request builder to execute, specified by Action . |
|
ExplainRequestBuilder |
prepareExplain(String index,
String type,
String id)
Computes a score explanation for the specified request. |
|
GetRequestBuilder |
prepareGet()
Gets the document that was indexed from an index with a type and id. |
|
GetRequestBuilder |
prepareGet(String index,
String type,
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(String index,
String type)
Index a document associated with a given index and type. |
|
IndexRequestBuilder |
prepareIndex(String index,
String type,
String id)
Index a document associated with a given index and type. |
|
MoreLikeThisRequestBuilder |
prepareMoreLikeThis(String index,
String type,
String id)
A more like this action to search for documents that are "like" a specific document. |
|
MultiGetRequestBuilder |
prepareMultiGet()
Multi get documents. |
|
MultiSearchRequestBuilder |
prepareMultiSearch()
Performs multiple search requests. |
|
PercolateRequestBuilder |
preparePercolate(String index,
String type)
Percolates a request returning the matches documents. |
|
SearchRequestBuilder |
prepareSearch(String... indices)
Search across one or more indices and one or more types with a query. |
|
SearchScrollRequestBuilder |
prepareSearchScroll(String scrollId)
A search scroll request to continue searching a previous scrollable search request. |
|
UpdateRequestBuilder |
prepareUpdate()
Updates a document based on a script. |
|
UpdateRequestBuilder |
prepareUpdate(String index,
String type,
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. |
|
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. |
Method Detail |
---|
void close()
AdminClient admin()
<Request extends ActionRequest,Response extends ActionResponse,RequestBuilder extends ActionRequestBuilder<Request,Response>> ActionFuture<Response> execute(Action<Request,Response,RequestBuilder> action, Request request)
Action
.
Request
- Teh request type.Response
- the response type.RequestBuilder
- The request builder type.action
- The action type to execute.request
- The action request.
<Request extends ActionRequest,Response extends ActionResponse,RequestBuilder extends ActionRequestBuilder<Request,Response>> void execute(Action<Request,Response,RequestBuilder> action, Request request, ActionListener<Response> listener)
Action
.
Request
- The request type.Response
- The response type.RequestBuilder
- The request builder type.action
- The action type to execute.request
- Teh action request.listener
- The listener to receive the response back.<Request extends ActionRequest,Response extends ActionResponse,RequestBuilder extends ActionRequestBuilder<Request,Response>> RequestBuilder prepareExecute(Action<Request,Response,RequestBuilder> action)
Action
.
Request
- The request type.Response
- The response type.RequestBuilder
- The request builder.action
- The action type to execute.
ActionFuture<IndexResponse> index(IndexRequest request)
The id is optional, if it is not provided, one will be generated automatically.
request
- The index request
Requests.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 request
void update(UpdateRequest request, ActionListener<UpdateResponse> listener)
request
- The update requestlistener
- A listener to be notified with a resultUpdateRequestBuilder prepareUpdate()
UpdateRequestBuilder prepareUpdate(String index, String type, String id)
IndexRequestBuilder prepareIndex(String index, 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(String index, String type, @Nullable 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 request
Requests.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(String index, String type, 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 request
Requests.bulkRequest()
void bulk(BulkRequest request, ActionListener<BulkResponse> listener)
request
- The bulk requestlistener
- A listener to be notified with a resultRequests.bulkRequest()
BulkRequestBuilder prepareBulk()
ActionFuture<DeleteByQueryResponse> deleteByQuery(DeleteByQueryRequest request)
request
- The delete by query request
Requests.deleteByQueryRequest(String...)
void deleteByQuery(DeleteByQueryRequest request, ActionListener<DeleteByQueryResponse> listener)
request
- The delete by query requestlistener
- A listener to be notified with a resultRequests.deleteByQueryRequest(String...)
DeleteByQueryRequestBuilder prepareDeleteByQuery(String... indices)
ActionFuture<GetResponse> get(GetRequest request)
request
- The get request
Requests.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(String index, @Nullable String type, String id)
ActionFuture<MultiGetResponse> multiGet(MultiGetRequest request)
void multiGet(MultiGetRequest request, ActionListener<MultiGetResponse> listener)
MultiGetRequestBuilder prepareMultiGet()
ActionFuture<CountResponse> count(CountRequest request)
request
- The count request
Requests.countRequest(String...)
void count(CountRequest request, ActionListener<CountResponse> listener)
request
- The count requestlistener
- A listener to be notified of the resultRequests.countRequest(String...)
CountRequestBuilder prepareCount(String... indices)
ActionFuture<SearchResponse> search(SearchRequest request)
request
- The search request
Requests.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(String... indices)
ActionFuture<SearchResponse> searchScroll(SearchScrollRequest request)
request
- The search scroll request
Requests.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(String scrollId)
ActionFuture<MultiSearchResponse> multiSearch(MultiSearchRequest request)
void multiSearch(MultiSearchRequest request, ActionListener<MultiSearchResponse> listener)
MultiSearchRequestBuilder prepareMultiSearch()
ActionFuture<SearchResponse> moreLikeThis(MoreLikeThisRequest request)
request
- The more like this request
void moreLikeThis(MoreLikeThisRequest request, ActionListener<SearchResponse> listener)
request
- The more like this requestlistener
- A listener to be notified of the resultMoreLikeThisRequestBuilder prepareMoreLikeThis(String index, String type, String id)
index
- The index to load the document fromtype
- The type of the documentid
- The id of the documentActionFuture<PercolateResponse> percolate(PercolateRequest request)
void percolate(PercolateRequest request, ActionListener<PercolateResponse> listener)
PercolateRequestBuilder preparePercolate(String index, String type)
index
- The index to percolate the doctype
- The type of the docExplainRequestBuilder prepareExplain(String index, String type, 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 result
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |