Package org.elasticsearch.client.support
Class AbstractClient
java.lang.Object
org.elasticsearch.client.support.AbstractClient
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,Client
,ElasticsearchClient
,org.elasticsearch.common.lease.Releasable
- Direct Known Subclasses:
FilterClient
,NodeClient
,TransportClient
public abstract class AbstractClient extends java.lang.Object implements Client
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.logging.log4j.Logger
logger
protected Settings
settings
Fields inherited from interface org.elasticsearch.client.Client
CLIENT_TYPE_SETTING_S
-
Constructor Summary
Constructors Constructor Description AbstractClient(Settings settings, ThreadPool threadPool)
-
Method Summary
Modifier and Type Method 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>
voiddoExecute(ActionType<Response> action, Request request, ActionListener<Response> listener)
<Request extends ActionRequest, Response extends ActionResponse>
ActionFuture<Response>execute(ActionType<Response> action, Request request)
Executes a generic action, denoted by anActionType
.<Request extends ActionRequest, Response extends ActionResponse>
voidexecute(ActionType<Response> 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 requestvoid
fieldCaps(FieldCapabilitiesRequest request, ActionListener<FieldCapabilitiesResponse> listener)
An action that returns the field capabilities from the provided requestClient
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.BulkRequestBuilder
prepareBulk(java.lang.String globalIndex, java.lang.String globalType)
Executes a bulk of index / delete operations with default index and/or typeClearScrollRequestBuilder
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(java.lang.String... indices)
Builder for the field capabilities request.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
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 settingsActionFuture<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 clientActionFuture<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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.client.Client
getRemoteClusterClient
Methods inherited from interface org.elasticsearch.common.lease.Releasable
close
-
Field Details
-
logger
protected final org.apache.logging.log4j.Logger logger -
settings
-
-
Constructor Details
-
AbstractClient
-
-
Method Details
-
settings
Description copied from interface:Client
Returns this clients settings -
threadPool
Description copied from interface:ElasticsearchClient
Returns the threadpool used to execute requests on this client- Specified by:
threadPool
in interfaceElasticsearchClient
-
admin
Description copied from interface:Client
The admin client that can be used to perform administrative operations. -
execute
public final <Request extends ActionRequest, Response extends ActionResponse> ActionFuture<Response> execute(ActionType<Response> action, Request request)Description copied from interface:ElasticsearchClient
Executes a generic action, denoted by anActionType
.- Specified by:
execute
in interfaceElasticsearchClient
- Type Parameters:
Request
- The request type.Response
- the response type.- Parameters:
action
- The action type to execute.request
- The action request.- Returns:
- A future allowing to get back the response.
-
execute
public final <Request extends ActionRequest, Response extends ActionResponse> void execute(ActionType<Response> action, Request request, ActionListener<Response> listener)This is the single execution point of *all* clients.- Specified by:
execute
in interfaceElasticsearchClient
- Type Parameters:
Request
- The request type.Response
- The response type.- Parameters:
action
- The action type to execute.request
- The action request.listener
- The listener to receive the response back.
-
doExecute
protected abstract <Request extends ActionRequest, Response extends ActionResponse> void doExecute(ActionType<Response> action, Request request, ActionListener<Response> listener) -
index
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 interfaceClient
- Parameters:
request
- The index request- Returns:
- The result future
- See Also:
Requests.indexRequest(String)
-
index
Description copied from interface:Client
Index a document 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 interfaceClient
- Parameters:
request
- The index requestlistener
- A listener to be notified with a result- See Also:
Requests.indexRequest(String)
-
prepareIndex
Description copied from interface:Client
Index a document associated with a given index and type.The id is optional, if it is not provided, one will be generated automatically.
- Specified by:
prepareIndex
in interfaceClient
-
prepareIndex
Description copied from interface:Client
Index a document associated with a given index and type.The id is optional, if it is not provided, one will be generated automatically.
- Specified by:
prepareIndex
in interfaceClient
- Parameters:
index
- The index to index the document totype
- The type to index the document to
-
prepareIndex
public IndexRequestBuilder prepareIndex(java.lang.String index, java.lang.String type, @Nullable java.lang.String id)Description copied from interface:Client
Index a document associated with a given index and type.The id is optional, if it is not provided, one will be generated automatically.
- Specified by:
prepareIndex
in interfaceClient
- Parameters:
index
- The index to index the document totype
- The type to index the document toid
- The id of the document
-
update
Description copied from interface:Client
Updates a document based on a script. -
update
Description copied from interface:Client
Updates a document based on a script. -
prepareUpdate
Description copied from interface:Client
Updates a document based on a script.- Specified by:
prepareUpdate
in interfaceClient
-
prepareUpdate
public UpdateRequestBuilder prepareUpdate(java.lang.String index, java.lang.String type, java.lang.String id)Description copied from interface:Client
Updates a document based on a script.- Specified by:
prepareUpdate
in interfaceClient
-
delete
Description copied from interface:Client
Deletes a document from the index based on the index, type and id.- Specified by:
delete
in interfaceClient
- Parameters:
request
- The delete request- Returns:
- The result future
- See Also:
Requests.deleteRequest(String)
-
delete
Description copied from interface:Client
Deletes a document from the index based on the index, type and id.- Specified by:
delete
in interfaceClient
- Parameters:
request
- The delete requestlistener
- A listener to be notified with a result- See Also:
Requests.deleteRequest(String)
-
prepareDelete
Description copied from interface:Client
Deletes a document from the index based on the index, type and id.- Specified by:
prepareDelete
in interfaceClient
-
prepareDelete
public DeleteRequestBuilder prepareDelete(java.lang.String index, java.lang.String type, java.lang.String id)Description copied from interface:Client
Deletes a document from the index based on the index, type and id.- Specified by:
prepareDelete
in interfaceClient
- Parameters:
index
- The index to delete the document fromtype
- The type of the document to deleteid
- The id of the document to delete
-
bulk
Description copied from interface:Client
Executes a bulk of index / delete operations.- Specified by:
bulk
in interfaceClient
- Parameters:
request
- The bulk request- Returns:
- The result future
- See Also:
Requests.bulkRequest()
-
bulk
Description copied from interface:Client
Executes a bulk of index / delete operations.- Specified by:
bulk
in interfaceClient
- Parameters:
request
- The bulk requestlistener
- A listener to be notified with a result- See Also:
Requests.bulkRequest()
-
prepareBulk
Description copied from interface:Client
Executes a bulk of index / delete operations.- Specified by:
prepareBulk
in interfaceClient
-
prepareBulk
public BulkRequestBuilder prepareBulk(@Nullable java.lang.String globalIndex, @Nullable java.lang.String globalType)Description copied from interface:Client
Executes a bulk of index / delete operations with default index and/or type- Specified by:
prepareBulk
in interfaceClient
-
get
Description copied from interface:Client
Gets the document that was indexed from an index with a type and id.- Specified by:
get
in interfaceClient
- Parameters:
request
- The get request- Returns:
- The result future
- See Also:
Requests.getRequest(String)
-
get
Description copied from interface:Client
Gets the document that was indexed from an index with a type and id.- Specified by:
get
in interfaceClient
- Parameters:
request
- The get requestlistener
- A listener to be notified with a result- See Also:
Requests.getRequest(String)
-
prepareGet
Description copied from interface:Client
Gets the document that was indexed from an index with a type and id.- Specified by:
prepareGet
in interfaceClient
-
prepareGet
public GetRequestBuilder prepareGet(java.lang.String index, java.lang.String type, java.lang.String id)Description copied from interface:Client
Gets the document that was indexed from an index with a type (optional) and id.- Specified by:
prepareGet
in interfaceClient
-
multiGet
Description copied from interface:Client
Multi get documents. -
multiGet
Description copied from interface:Client
Multi get documents. -
prepareMultiGet
Description copied from interface:Client
Multi get documents.- Specified by:
prepareMultiGet
in interfaceClient
-
search
Description copied from interface:Client
Search across one or more indices and one or more types with a query.- Specified by:
search
in interfaceClient
- Parameters:
request
- The search request- Returns:
- The result future
- See Also:
Requests.searchRequest(String...)
-
search
Description copied from interface:Client
Search across one or more indices and one or more types with a query.- Specified by:
search
in interfaceClient
- Parameters:
request
- The search requestlistener
- A listener to be notified of the result- See Also:
Requests.searchRequest(String...)
-
prepareSearch
Description copied from interface:Client
Search across one or more indices and one or more types with a query.- Specified by:
prepareSearch
in interfaceClient
-
searchScroll
Description copied from interface:Client
A search scroll request to continue searching a previous scrollable search request.- Specified by:
searchScroll
in interfaceClient
- Parameters:
request
- The search scroll request- Returns:
- The result future
- See Also:
Requests.searchScrollRequest(String)
-
searchScroll
Description copied from interface:Client
A search scroll request to continue searching a previous scrollable search request.- Specified by:
searchScroll
in interfaceClient
- Parameters:
request
- The search scroll requestlistener
- A listener to be notified of the result- See Also:
Requests.searchScrollRequest(String)
-
prepareSearchScroll
Description copied from interface:Client
A search scroll request to continue searching a previous scrollable search request.- Specified by:
prepareSearchScroll
in interfaceClient
-
multiSearch
Description copied from interface:Client
Performs multiple search requests.- Specified by:
multiSearch
in interfaceClient
-
multiSearch
Description copied from interface:Client
Performs multiple search requests.- Specified by:
multiSearch
in interfaceClient
-
prepareMultiSearch
Description copied from interface:Client
Performs multiple search requests.- Specified by:
prepareMultiSearch
in interfaceClient
-
termVectors
Description copied from interface:Client
An action that returns the term vectors for a specific document.- Specified by:
termVectors
in interfaceClient
- Parameters:
request
- The term vector request- Returns:
- The response future
-
termVectors
Description copied from interface:Client
An action that returns the term vectors for a specific document.- Specified by:
termVectors
in interfaceClient
- Parameters:
request
- The term vector request
-
prepareTermVectors
Description copied from interface:Client
Builder for the term vector request.- Specified by:
prepareTermVectors
in interfaceClient
-
prepareTermVectors
public TermVectorsRequestBuilder prepareTermVectors(java.lang.String index, java.lang.String type, java.lang.String id)Description copied from interface:Client
Builder for the term vector request.- Specified by:
prepareTermVectors
in interfaceClient
- Parameters:
index
- The index to load the document fromtype
- The type of the documentid
- The id of the document
-
multiTermVectors
Description copied from interface:Client
Multi get term vectors.- Specified by:
multiTermVectors
in interfaceClient
-
multiTermVectors
public void multiTermVectors(MultiTermVectorsRequest request, ActionListener<MultiTermVectorsResponse> listener)Description copied from interface:Client
Multi get term vectors.- Specified by:
multiTermVectors
in interfaceClient
-
prepareMultiTermVectors
Description copied from interface:Client
Multi get term vectors.- Specified by:
prepareMultiTermVectors
in interfaceClient
-
prepareExplain
public ExplainRequestBuilder prepareExplain(java.lang.String index, java.lang.String type, java.lang.String id)Description copied from interface:Client
Computes a score explanation for the specified request.- Specified by:
prepareExplain
in interfaceClient
- 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
Description copied from interface:Client
Computes a score explanation for the specified request. -
explain
Description copied from interface:Client
Computes a score explanation for the specified request. -
clearScroll
Description copied from interface:Client
Clears the search contexts associated with specified scroll ids.- Specified by:
clearScroll
in interfaceClient
-
clearScroll
Description copied from interface:Client
Clears the search contexts associated with specified scroll ids.- Specified by:
clearScroll
in interfaceClient
-
prepareClearScroll
Description copied from interface:Client
Clears the search contexts associated with specified scroll ids.- Specified by:
prepareClearScroll
in interfaceClient
-
fieldCaps
public void fieldCaps(FieldCapabilitiesRequest request, ActionListener<FieldCapabilitiesResponse> listener)Description copied from interface:Client
An action that returns the field capabilities from the provided request -
fieldCaps
Description copied from interface:Client
An action that returns the field capabilities from the provided request -
prepareFieldCaps
Description copied from interface:Client
Builder for the field capabilities request.- Specified by:
prepareFieldCaps
in interfaceClient
-
filterWithHeader
Description copied from interface:Client
Returns a new lightweight Client that applies all given headers to each of the requests issued from it.- Specified by:
filterWithHeader
in interfaceClient
-