org.elasticsearch.client.node
Class NodeClient

java.lang.Object
  extended by org.elasticsearch.util.component.AbstractComponent
      extended by org.elasticsearch.client.node.NodeClient
All Implemented Interfaces:
Client, InternalClient

public class NodeClient
extends AbstractComponent
implements InternalClient


Field Summary
 
Fields inherited from class org.elasticsearch.util.component.AbstractComponent
componentSettings, logger, settings
 
Constructor Summary
NodeClient(Settings settings, ThreadPool threadPool, NodeAdminClient admin, TransportIndexAction indexAction, TransportDeleteAction deleteAction, TransportDeleteByQueryAction deleteByQueryAction, TransportGetAction getAction, TransportCountAction countAction, TransportSearchAction searchAction, TransportSearchScrollAction searchScrollAction, TransportTermsAction termsAction, TransportMoreLikeThisAction moreLikeThisAction)
           
 
Method Summary
 AdminClient admin()
          The admin client that can be used to perform administrative 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.
 ActionFuture<GetResponse> get(GetRequest request)
          Gets the JSON source that was indexed from an index with a type and id.
 void get(GetRequest request, ActionListener<GetResponse> listener)
          Gets the JSON source 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 JSON source 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<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<TermsResponse> terms(TermsRequest request)
          A terms request to get terms in one or more indices of specific fields and their document frequencies (in how many document each term exists).
 void terms(TermsRequest request, ActionListener<TermsResponse> listener)
          A terms request to get terms in one or more indices of specific fields and their document frequencies (in how many document each term exists).
 ThreadPool threadPool()
           
 
Methods inherited from class org.elasticsearch.util.component.AbstractComponent
nodeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeClient

@Inject
public NodeClient(Settings settings,
                         ThreadPool threadPool,
                         NodeAdminClient admin,
                         TransportIndexAction indexAction,
                         TransportDeleteAction deleteAction,
                         TransportDeleteByQueryAction deleteByQueryAction,
                         TransportGetAction getAction,
                         TransportCountAction countAction,
                         TransportSearchAction searchAction,
                         TransportSearchScrollAction searchScrollAction,
                         TransportTermsAction termsAction,
                         TransportMoreLikeThisAction moreLikeThisAction)
Method Detail

threadPool

public ThreadPool threadPool()
Specified by:
threadPool in interface InternalClient

close

public void close()
Description copied from interface: Client
Closes the client.

Specified by:
close in interface Client

admin

public AdminClient admin()
Description copied from interface: Client
The admin client that can be used to perform administrative operations.

Specified by:
admin in interface Client

index

public ActionFuture<IndexResponse> index(IndexRequest request)
Description copied from interface: Client
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.

Specified by:
index in interface Client
Parameters:
request - The index request
Returns:
The result future
See Also:
Requests.indexRequest(String)

index

public void index(IndexRequest request,
                  ActionListener<IndexResponse> listener)
Description copied from interface: Client
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.

Specified by:
index in interface Client
Parameters:
request - The index request
listener - A listener to be notified with a result
See Also:
Requests.indexRequest(String)

delete

public ActionFuture<DeleteResponse> delete(DeleteRequest request)
Description copied from interface: Client
Deletes a document from the index based on the index, type and id.

Specified by:
delete in interface Client
Parameters:
request - The delete request
Returns:
The result future
See Also:
Requests.deleteRequest(String)

delete

public void delete(DeleteRequest request,
                   ActionListener<DeleteResponse> listener)
Description copied from interface: Client
Deletes a document from the index based on the index, type and id.

Specified by:
delete in interface Client
Parameters:
request - The delete request
listener - A listener to be notified with a result
See Also:
Requests.deleteRequest(String)

deleteByQuery

public ActionFuture<DeleteByQueryResponse> deleteByQuery(DeleteByQueryRequest request)
Description copied from interface: Client
Deletes all documents from one or more indices based on a query.

Specified by:
deleteByQuery in interface Client
Parameters:
request - The delete by query request
Returns:
The result future
See Also:
Requests.deleteByQueryRequest(String...)

deleteByQuery

public void deleteByQuery(DeleteByQueryRequest request,
                          ActionListener<DeleteByQueryResponse> listener)
Description copied from interface: Client
Deletes all documents from one or more indices based on a query.

Specified by:
deleteByQuery in interface Client
Parameters:
request - The delete by query request
listener - A listener to be notified with a result
See Also:
Requests.deleteByQueryRequest(String...)

get

public ActionFuture<GetResponse> get(GetRequest request)
Description copied from interface: Client
Gets the JSON source that was indexed from an index with a type and id.

Specified by:
get in interface Client
Parameters:
request - The get request
Returns:
The result future
See Also:
Requests.getRequest(String)

get

public void get(GetRequest request,
                ActionListener<GetResponse> listener)
Description copied from interface: Client
Gets the JSON source that was indexed from an index with a type and id.

Specified by:
get in interface Client
Parameters:
request - The get request
listener - A listener to be notified with a result
See Also:
Requests.getRequest(String)

count

public ActionFuture<CountResponse> count(CountRequest request)
Description copied from interface: Client
A count of all the documents matching a specific query.

Specified by:
count in interface Client
Parameters:
request - The count request
Returns:
The result future
See Also:
Requests.countRequest(String...)

count

public void count(CountRequest request,
                  ActionListener<CountResponse> listener)
Description copied from interface: Client
A count of all the documents matching a specific query.

Specified by:
count in interface Client
Parameters:
request - The count request
listener - A listener to be notified of the result
See Also:
Requests.countRequest(String...)

search

public ActionFuture<SearchResponse> search(SearchRequest request)
Description copied from interface: Client
Search across one or more indices and one or more types with a query.

Specified by:
search in interface Client
Parameters:
request - The search request
Returns:
The result future
See Also:
Requests.searchRequest(String...)

search

public void search(SearchRequest request,
                   ActionListener<SearchResponse> listener)
Description copied from interface: Client
Search across one or more indices and one or more types with a query.

Specified by:
search in interface Client
Parameters:
request - The search request
listener - A listener to be notified of the result
See Also:
Requests.searchRequest(String...)

searchScroll

public ActionFuture<SearchResponse> searchScroll(SearchScrollRequest request)
Description copied from interface: Client
A search scroll request to continue searching a previous scrollable search request.

Specified by:
searchScroll in interface Client
Parameters:
request - The search scroll request
Returns:
The result future
See Also:
Requests.searchScrollRequest(String)

searchScroll

public void searchScroll(SearchScrollRequest request,
                         ActionListener<SearchResponse> listener)
Description copied from interface: Client
A search scroll request to continue searching a previous scrollable search request.

Specified by:
searchScroll in interface Client
Parameters:
request - The search scroll request
listener - A listener to be notified of the result
See Also:
Requests.searchScrollRequest(String)

terms

public ActionFuture<TermsResponse> terms(TermsRequest request)
Description copied from interface: Client
A terms request to get terms in one or more indices of specific fields and their document frequencies (in how many document each term exists).

Specified by:
terms in interface Client
Parameters:
request - The term request
Returns:
The result future
See Also:
Requests.termsRequest(String...)

terms

public void terms(TermsRequest request,
                  ActionListener<TermsResponse> listener)
Description copied from interface: Client
A terms request to get terms in one or more indices of specific fields and their document frequencies (in how many document each term exists).

Specified by:
terms in interface Client
Parameters:
request - The term request
listener - A listener to be notified of the result
See Also:
Requests.termsRequest(String...)

moreLikeThis

public ActionFuture<SearchResponse> moreLikeThis(MoreLikeThisRequest request)
Description copied from interface: Client
A more like this action to search for documents that are "like" a specific document.

Specified by:
moreLikeThis in interface Client
Parameters:
request - The more like this request
Returns:
The response future

moreLikeThis

public void moreLikeThis(MoreLikeThisRequest request,
                         ActionListener<SearchResponse> listener)
Description copied from interface: Client
A more like this action to search for documents that are "like" a specific document.

Specified by:
moreLikeThis in interface Client
Parameters:
request - The more like this request
listener - A listener to be notified of the result