public abstract class AbstractClient extends AbstractComponent implements Client
deprecationLogger, logger, settings
CLIENT_TYPE_SETTING_S
Constructor and Description |
---|
AbstractClient(Settings settings,
ThreadPool threadPool) |
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.
|
protected abstract <Request extends ActionRequest,Response extends ActionResponse,RequestBuilder extends ActionRequestBuilder<Request,Response,RequestBuilder>> |
doExecute(Action<Request,Response,RequestBuilder> action,
Request request,
ActionListener<Response> listener) |
<Request extends ActionRequest,Response extends ActionResponse,RequestBuilder extends ActionRequestBuilder<Request,Response,RequestBuilder>> |
execute(Action<Request,Response,RequestBuilder> action,
Request request)
Executes a generic action, denoted by an
Action . |
<Request extends ActionRequest,Response extends ActionResponse,RequestBuilder extends ActionRequestBuilder<Request,Response,RequestBuilder>> |
execute(Action<Request,Response,RequestBuilder> action,
Request request,
ActionListener<Response> listener)
This is the single execution point of *all* clients.
|
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) |
void |
fieldStats(FieldStatsRequest request,
ActionListener<FieldStatsResponse> listener) |
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.
|
<Request extends ActionRequest,Response extends ActionResponse,RequestBuilder extends ActionRequestBuilder<Request,Response,RequestBuilder>> |
prepareExecute(Action<Request,Response,RequestBuilder> action)
Prepares a request builder to execute, specified by
Action . |
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() |
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.
|
ThreadPool |
threadPool()
Returns the threadpool used to execute requests on this client
|
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.
|
logDeprecatedSetting, logRemovedSetting, nodeName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
public AbstractClient(Settings settings, ThreadPool threadPool)
public final Settings settings()
Client
public final ThreadPool threadPool()
ElasticsearchClient
threadPool
in interface ElasticsearchClient
public final AdminClient admin()
Client
public final <Request extends ActionRequest,Response extends ActionResponse,RequestBuilder extends ActionRequestBuilder<Request,Response,RequestBuilder>> RequestBuilder prepareExecute(Action<Request,Response,RequestBuilder> action)
ElasticsearchClient
Action
.prepareExecute
in interface ElasticsearchClient
Request
- The request type.Response
- The response type.RequestBuilder
- The request builder.action
- The action type to execute.public final <Request extends ActionRequest,Response extends ActionResponse,RequestBuilder extends ActionRequestBuilder<Request,Response,RequestBuilder>> ActionFuture<Response> execute(Action<Request,Response,RequestBuilder> action, Request request)
ElasticsearchClient
Action
.execute
in interface ElasticsearchClient
Request
- The request type.Response
- the response type.RequestBuilder
- The request builder type.action
- The action type to execute.request
- The action request.public final <Request extends ActionRequest,Response extends ActionResponse,RequestBuilder extends ActionRequestBuilder<Request,Response,RequestBuilder>> void execute(Action<Request,Response,RequestBuilder> action, Request request, ActionListener<Response> listener)
execute
in interface ElasticsearchClient
Request
- The request type.Response
- The response type.RequestBuilder
- The request builder type.action
- The action type to execute.request
- The action request.listener
- The listener to receive the response back.protected abstract <Request extends ActionRequest,Response extends ActionResponse,RequestBuilder extends ActionRequestBuilder<Request,Response,RequestBuilder>> void doExecute(Action<Request,Response,RequestBuilder> action, Request request, ActionListener<Response> listener)
public ActionFuture<IndexResponse> index(IndexRequest request)
Client
The id is optional, if it is not provided, one will be generated automatically.
index
in interface Client
request
- The index requestRequests.indexRequest(String)
public void index(IndexRequest request, ActionListener<IndexResponse> listener)
Client
The id is optional, if it is not provided, one will be generated automatically.
index
in interface Client
request
- The index requestlistener
- A listener to be notified with a resultRequests.indexRequest(String)
public IndexRequestBuilder prepareIndex()
Client
The id is optional, if it is not provided, one will be generated automatically.
prepareIndex
in interface Client
public IndexRequestBuilder prepareIndex(java.lang.String index, java.lang.String type)
Client
The id is optional, if it is not provided, one will be generated automatically.
prepareIndex
in interface Client
index
- The index to index the document totype
- The type to index the document topublic IndexRequestBuilder prepareIndex(java.lang.String index, java.lang.String type, @Nullable java.lang.String id)
Client
The id is optional, if it is not provided, one will be generated automatically.
prepareIndex
in interface Client
index
- The index to index the document totype
- The type to index the document toid
- The id of the documentpublic ActionFuture<UpdateResponse> update(UpdateRequest request)
Client
public void update(UpdateRequest request, ActionListener<UpdateResponse> listener)
Client
public UpdateRequestBuilder prepareUpdate()
Client
prepareUpdate
in interface Client
public UpdateRequestBuilder prepareUpdate(java.lang.String index, java.lang.String type, java.lang.String id)
Client
prepareUpdate
in interface Client
public ActionFuture<DeleteResponse> delete(DeleteRequest request)
Client
delete
in interface Client
request
- The delete requestRequests.deleteRequest(String)
public void delete(DeleteRequest request, ActionListener<DeleteResponse> listener)
Client
delete
in interface Client
request
- The delete requestlistener
- A listener to be notified with a resultRequests.deleteRequest(String)
public DeleteRequestBuilder prepareDelete()
Client
prepareDelete
in interface Client
public DeleteRequestBuilder prepareDelete(java.lang.String index, java.lang.String type, java.lang.String id)
Client
prepareDelete
in interface Client
index
- The index to delete the document fromtype
- The type of the document to deleteid
- The id of the document to deletepublic ActionFuture<BulkResponse> bulk(BulkRequest request)
Client
bulk
in interface Client
request
- The bulk requestRequests.bulkRequest()
public void bulk(BulkRequest request, ActionListener<BulkResponse> listener)
Client
bulk
in interface Client
request
- The bulk requestlistener
- A listener to be notified with a resultRequests.bulkRequest()
public BulkRequestBuilder prepareBulk()
Client
prepareBulk
in interface Client
public ActionFuture<GetResponse> get(GetRequest request)
Client
get
in interface Client
request
- The get requestRequests.getRequest(String)
public void get(GetRequest request, ActionListener<GetResponse> listener)
Client
get
in interface Client
request
- The get requestlistener
- A listener to be notified with a resultRequests.getRequest(String)
public GetRequestBuilder prepareGet()
Client
prepareGet
in interface Client
public GetRequestBuilder prepareGet(java.lang.String index, java.lang.String type, java.lang.String id)
Client
prepareGet
in interface Client
public ActionFuture<MultiGetResponse> multiGet(MultiGetRequest request)
Client
public void multiGet(MultiGetRequest request, ActionListener<MultiGetResponse> listener)
Client
public MultiGetRequestBuilder prepareMultiGet()
Client
prepareMultiGet
in interface Client
public ActionFuture<SearchResponse> search(SearchRequest request)
Client
search
in interface Client
request
- The search requestRequests.searchRequest(String...)
public void search(SearchRequest request, ActionListener<SearchResponse> listener)
Client
search
in interface Client
request
- The search requestlistener
- A listener to be notified of the resultRequests.searchRequest(String...)
public SearchRequestBuilder prepareSearch(java.lang.String... indices)
Client
prepareSearch
in interface Client
public ActionFuture<SearchResponse> searchScroll(SearchScrollRequest request)
Client
searchScroll
in interface Client
request
- The search scroll requestRequests.searchScrollRequest(String)
public void searchScroll(SearchScrollRequest request, ActionListener<SearchResponse> listener)
Client
searchScroll
in interface Client
request
- The search scroll requestlistener
- A listener to be notified of the resultRequests.searchScrollRequest(String)
public SearchScrollRequestBuilder prepareSearchScroll(java.lang.String scrollId)
Client
prepareSearchScroll
in interface Client
public ActionFuture<MultiSearchResponse> multiSearch(MultiSearchRequest request)
Client
multiSearch
in interface Client
public void multiSearch(MultiSearchRequest request, ActionListener<MultiSearchResponse> listener)
Client
multiSearch
in interface Client
public MultiSearchRequestBuilder prepareMultiSearch()
Client
prepareMultiSearch
in interface Client
public ActionFuture<TermVectorsResponse> termVectors(TermVectorsRequest request)
Client
termVectors
in interface Client
request
- The term vector requestpublic void termVectors(TermVectorsRequest request, ActionListener<TermVectorsResponse> listener)
Client
termVectors
in interface Client
request
- The term vector requestpublic TermVectorsRequestBuilder prepareTermVectors()
Client
prepareTermVectors
in interface Client
public TermVectorsRequestBuilder prepareTermVectors(java.lang.String index, java.lang.String type, java.lang.String id)
Client
prepareTermVectors
in interface Client
index
- The index to load the document fromtype
- The type of the documentid
- The id of the document@Deprecated public ActionFuture<TermVectorsResponse> termVector(TermVectorsRequest request)
Client
termVector
in interface Client
request
- The term vector request@Deprecated public void termVector(TermVectorsRequest request, ActionListener<TermVectorsResponse> listener)
Client
termVector
in interface Client
request
- The term vector request@Deprecated public TermVectorsRequestBuilder prepareTermVector()
Client
prepareTermVector
in interface Client
@Deprecated public TermVectorsRequestBuilder prepareTermVector(java.lang.String index, java.lang.String type, java.lang.String id)
Client
prepareTermVector
in interface Client
index
- The index to load the document fromtype
- The type of the documentid
- The id of the documentpublic ActionFuture<MultiTermVectorsResponse> multiTermVectors(MultiTermVectorsRequest request)
Client
multiTermVectors
in interface Client
public void multiTermVectors(MultiTermVectorsRequest request, ActionListener<MultiTermVectorsResponse> listener)
Client
multiTermVectors
in interface Client
public MultiTermVectorsRequestBuilder prepareMultiTermVectors()
Client
prepareMultiTermVectors
in interface Client
public ExplainRequestBuilder prepareExplain(java.lang.String index, java.lang.String type, java.lang.String id)
Client
prepareExplain
in interface Client
index
- The index this explain is targeted fortype
- The type this explain is targeted forid
- The document identifier this explain is targeted forpublic ActionFuture<ExplainResponse> explain(ExplainRequest request)
Client
public void explain(ExplainRequest request, ActionListener<ExplainResponse> listener)
Client
public void clearScroll(ClearScrollRequest request, ActionListener<ClearScrollResponse> listener)
Client
clearScroll
in interface Client
public ActionFuture<ClearScrollResponse> clearScroll(ClearScrollRequest request)
Client
clearScroll
in interface Client
public ClearScrollRequestBuilder prepareClearScroll()
Client
prepareClearScroll
in interface Client
public void fieldStats(FieldStatsRequest request, ActionListener<FieldStatsResponse> listener)
fieldStats
in interface Client
public ActionFuture<FieldStatsResponse> fieldStats(FieldStatsRequest request)
fieldStats
in interface Client
public FieldStatsRequestBuilder prepareFieldStats()
prepareFieldStats
in interface Client
public void fieldCaps(FieldCapabilitiesRequest request, ActionListener<FieldCapabilitiesResponse> listener)
Client
public ActionFuture<FieldCapabilitiesResponse> fieldCaps(FieldCapabilitiesRequest request)
Client
public FieldCapabilitiesRequestBuilder prepareFieldCaps()
Client
prepareFieldCaps
in interface Client
public Client filterWithHeader(java.util.Map<java.lang.String,java.lang.String> headers)
Client
filterWithHeader
in interface Client