Interface ElasticSearchClient<T extends ElasticSearchClient>
-
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
ElasticSearchNativeClient
public interface ElasticSearchClient<T extends ElasticSearchClient> extends Closeable
This is the contract for a JBoss Dashbuilder REST client for ElasticSearch servers.
Default ElasticSearch native client implementation is provided by classes in package
org.dashbuilder.dataprovider.backend.elasticsearch.rest.implYou can implement your own client too.
-
-
Field Summary
Fields Modifier and Type Field Description static StringHEADER_RESPONSE_CODEstatic intRESPONSE_CODE_NOT_FOUNDstatic intRESPONSE_CODE_OK
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TclusterName(String clusterName)Builds the client for a given cluster.CountResponsecount(String[] index, String[] type)Count documents for a given index/es and type/esMappingsResponsegetMappings(String... index)Obtain the mappings for a given index/es.Tindex(String... indexes)Builds the client for a given index/es.SearchResponsesearch(org.dashbuilder.dataset.def.ElasticSearchDataSetDef definition, org.dashbuilder.dataset.DataSetMetadata metadata, SearchRequest searchRequest)Obtain documents for a given index/es and type/esTserverURL(String serverURL)Builds the client for a given serer URL.TsetTimeout(int timeout)Sets the timeout value for the HTTP rest client requests.Ttype(String... types)Builds the client for a given types/es.
-
-
-
Field Detail
-
HEADER_RESPONSE_CODE
static final String HEADER_RESPONSE_CODE
- See Also:
- Constant Field Values
-
RESPONSE_CODE_NOT_FOUND
static final int RESPONSE_CODE_NOT_FOUND
- See Also:
- Constant Field Values
-
RESPONSE_CODE_OK
static final int RESPONSE_CODE_OK
- See Also:
- Constant Field Values
-
-
Method Detail
-
serverURL
T serverURL(String serverURL)
Builds the client for a given serer URL.- Parameters:
serverURL- The ElasticSearch server URL.- Returns:
- The REST client for the given server URL.
-
index
T index(String... indexes)
Builds the client for a given index/es.- Parameters:
indexes- The ElasticSearch index/es.- Returns:
- The REST client for the given index/es.
-
type
T type(String... types)
Builds the client for a given types/es.- Parameters:
types- The ElasticSearch types/es.- Returns:
- The REST client for the given types/es.
-
clusterName
T clusterName(String clusterName)
Builds the client for a given cluster.- Parameters:
clusterName- The ElasticSearch cluster name.- Returns:
- The REST client for the given cluster.
-
setTimeout
T setTimeout(int timeout)
Sets the timeout value for the HTTP rest client requests.- Parameters:
timeout- The timeout value in miliseconds.
-
getMappings
MappingsResponse getMappings(String... index) throws ElasticSearchClientGenericException
Obtain the mappings for a given index/es.- Parameters:
index- The index/es to obtain the mappings.- Returns:
- The mappings for the given index/es
- Throws:
ElasticSearchClientGenericException
-
count
CountResponse count(String[] index, String[] type) throws ElasticSearchClientGenericException
Count documents for a given index/es and type/es- Parameters:
index- The index/es for the document type to count. If value isnullreturns the count number of all documents if all indexes.type- The type/s of the documents to count. If value isnullreturns the count number of all documents in all indexes or in the index specified byindex.- Returns:
- The number of documents for a given index/es and type/es
- Throws:
ElasticSearchClientGenericException
-
search
SearchResponse search(org.dashbuilder.dataset.def.ElasticSearchDataSetDef definition, org.dashbuilder.dataset.DataSetMetadata metadata, SearchRequest searchRequest) throws ElasticSearchClientGenericException
Obtain documents for a given index/es and type/es
If the index/es value set in the
requestisnullreturns all documents of all indexes.If the type/s value set in the
requestisnullreturns all documents in all indexes or in the index specified byindex.- Parameters:
definition- The dataset definition.metadata- The metadata.searchRequest- The search request.- Returns:
- The number of documents for a given index/es and type/es
- Throws:
ElasticSearchClientGenericException
-
-