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.impl
You can implement your own client too.
| Modifier and Type | Field and Description |
|---|---|
static String |
HEADER_RESPONSE_CODE |
static int |
RESPONSE_CODE_NOT_FOUND |
static int |
RESPONSE_CODE_OK |
| Modifier and Type | Method and Description |
|---|---|
T |
clusterName(String clusterName)
Builds the client for a given cluster.
|
CountResponse |
count(String[] index,
String[] type)
Count documents for a given index/es and type/es
|
MappingsResponse |
getMappings(String... index)
Obtain the mappings for a given index/es.
|
T |
index(String... indexes)
Builds the client for a given index/es.
|
SearchResponse |
search(ElasticSearchDataSetDef definition,
DataSetMetadata metadata,
SearchRequest searchRequest)
Obtain documents for a given index/es and type/es
If the index/es value set in the
request is null returns all documents of all indexes. |
T |
serverURL(String serverURL)
Builds the client for a given serer URL.
|
T |
setTimeout(int timeout)
Sets the timeout value for the HTTP rest client requests.
|
T |
type(String... types)
Builds the client for a given types/es.
|
static final String HEADER_RESPONSE_CODE
static final int RESPONSE_CODE_NOT_FOUND
static final int RESPONSE_CODE_OK
T serverURL(String serverURL)
serverURL - The ElasticSearch server URL.T index(String... indexes)
indexes - The ElasticSearch index/es.T type(String... types)
types - The ElasticSearch types/es.T clusterName(String clusterName)
clusterName - The ElasticSearch cluster name.T setTimeout(int timeout)
timeout - The timeout value in miliseconds.MappingsResponse getMappings(String... index) throws ElasticSearchClientGenericException
index - The index/es to obtain the mappings.ElasticSearchClientGenericExceptionCountResponse count(String[] index, String[] type) throws ElasticSearchClientGenericException
index - The index/es for the document type to count. If value is null returns the count number of all documents if all indexes.type - The type/s of the documents to count. If value is null returns the count number of all documents in all indexes or in the index specified by index.ElasticSearchClientGenericExceptionSearchResponse search(ElasticSearchDataSetDef definition, DataSetMetadata metadata, SearchRequest searchRequest) throws ElasticSearchClientGenericException
Obtain documents for a given index/es and type/es
If the index/es value set in the request is null returns all documents of all indexes.
If the type/s value set in the request is null returns all documents in all indexes or in the index specified by index.
definition - The dataset definition.metadata - The metadata.searchRequest - The search request.ElasticSearchClientGenericExceptionCopyright © 2017–2019 JBoss by Red Hat. All rights reserved.