Package org.nuxeo.elasticsearch.client
Class ESRestClient
- java.lang.Object
-
- org.nuxeo.elasticsearch.client.ESRestClient
-
- All Implemented Interfaces:
AutoCloseable
,ESClient
public class ESRestClient extends Object implements ESClient
- Since:
- 9.3
-
-
Field Summary
Fields Modifier and Type Field Description protected org.elasticsearch.client.RestHighLevelClient
client
static String
CREATE_INDEX_TIMEOUT
protected org.elasticsearch.client.RestClient
lowLevelClient
-
Constructor Summary
Constructors Constructor Description ESRestClient(org.elasticsearch.client.RestClient lowLevelRestClient, org.elasticsearch.client.RestHighLevelClient client)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
aliasExists(String aliasName)
org.elasticsearch.action.bulk.BulkResponse
bulk(org.elasticsearch.action.bulk.BulkRequest request)
org.elasticsearch.action.bulk.BulkProcessor.Builder
bulkProcessorBuilder(org.elasticsearch.action.bulk.BulkProcessor.Listener bulkListener)
Creates an elasticsearch BulkProcessor builder.org.elasticsearch.action.search.ClearScrollResponse
clearScroll(org.elasticsearch.action.search.ClearScrollRequest request)
void
close()
protected void
createAlias(String aliasName, String indexName)
void
createIndex(String indexName, String jsonSettings)
void
createMapping(String indexName, String type, String jsonMapping)
org.elasticsearch.action.delete.DeleteResponse
delete(org.elasticsearch.action.delete.DeleteRequest request)
protected void
deleteAlias(String aliasName)
void
deleteIndex(String indexName, int timeoutSecond)
void
flush(String indexName)
org.elasticsearch.action.get.GetResponse
get(org.elasticsearch.action.get.GetRequest request)
String
getFirstIndexForAlias(String aliasName)
Returns the name of the index referenced by the alias.org.elasticsearch.cluster.health.ClusterHealthStatus
getHealthStatus(String[] indexNames)
protected String
getIndexesAsString(String[] indexNames)
String
getNodesInfo()
String
getNodesStats()
protected io.opencensus.common.Scope
getScopedSpan(String name, String request)
org.elasticsearch.action.index.IndexResponse
index(org.elasticsearch.action.index.IndexRequest request)
Performs the indexing request.boolean
indexExists(String indexName)
boolean
mappingExists(String indexName, String type)
void
optimize(String indexName)
protected org.elasticsearch.client.Response
performRequest(org.elasticsearch.client.Request request)
protected org.elasticsearch.client.Response
performRequestWithTracing(org.elasticsearch.client.Request request)
void
refresh(String indexName)
org.elasticsearch.action.search.SearchResponse
search(org.elasticsearch.action.search.SearchRequest request)
org.elasticsearch.action.search.SearchResponse
searchScroll(org.elasticsearch.action.search.SearchScrollRequest request)
void
updateAlias(String aliasName, String indexName)
boolean
waitForYellowStatus(String[] indexNames, int timeoutSecond)
-
-
-
Field Detail
-
CREATE_INDEX_TIMEOUT
public static final String CREATE_INDEX_TIMEOUT
- See Also:
- Constant Field Values
-
lowLevelClient
protected org.elasticsearch.client.RestClient lowLevelClient
-
client
protected org.elasticsearch.client.RestHighLevelClient client
-
-
Constructor Detail
-
ESRestClient
public ESRestClient(org.elasticsearch.client.RestClient lowLevelRestClient, org.elasticsearch.client.RestHighLevelClient client)
-
-
Method Detail
-
waitForYellowStatus
public boolean waitForYellowStatus(String[] indexNames, int timeoutSecond)
- Specified by:
waitForYellowStatus
in interfaceESClient
-
getIndexesAsString
protected String getIndexesAsString(String[] indexNames)
-
getHealthStatus
public org.elasticsearch.cluster.health.ClusterHealthStatus getHealthStatus(String[] indexNames)
- Specified by:
getHealthStatus
in interfaceESClient
-
indexExists
public boolean indexExists(String indexName)
- Specified by:
indexExists
in interfaceESClient
-
mappingExists
public boolean mappingExists(String indexName, String type)
- Specified by:
mappingExists
in interfaceESClient
-
deleteIndex
public void deleteIndex(String indexName, int timeoutSecond)
- Specified by:
deleteIndex
in interfaceESClient
-
createIndex
public void createIndex(String indexName, String jsonSettings)
- Specified by:
createIndex
in interfaceESClient
-
createMapping
public void createMapping(String indexName, String type, String jsonMapping)
- Specified by:
createMapping
in interfaceESClient
-
performRequest
protected org.elasticsearch.client.Response performRequest(org.elasticsearch.client.Request request)
-
performRequestWithTracing
protected org.elasticsearch.client.Response performRequestWithTracing(org.elasticsearch.client.Request request)
-
getNodesInfo
public String getNodesInfo()
- Specified by:
getNodesInfo
in interfaceESClient
-
getNodesStats
public String getNodesStats()
- Specified by:
getNodesStats
in interfaceESClient
-
aliasExists
public boolean aliasExists(String aliasName)
- Specified by:
aliasExists
in interfaceESClient
-
getFirstIndexForAlias
public String getFirstIndexForAlias(String aliasName)
Description copied from interface:ESClient
Returns the name of the index referenced by the alias. Returns null if the alias does not exists.- Specified by:
getFirstIndexForAlias
in interfaceESClient
-
updateAlias
public void updateAlias(String aliasName, String indexName)
- Specified by:
updateAlias
in interfaceESClient
-
deleteAlias
protected void deleteAlias(String aliasName)
-
createAlias
protected void createAlias(String aliasName, String indexName)
-
bulk
public org.elasticsearch.action.bulk.BulkResponse bulk(org.elasticsearch.action.bulk.BulkRequest request)
-
delete
public org.elasticsearch.action.delete.DeleteResponse delete(org.elasticsearch.action.delete.DeleteRequest request)
-
search
public org.elasticsearch.action.search.SearchResponse search(org.elasticsearch.action.search.SearchRequest request)
-
searchScroll
public org.elasticsearch.action.search.SearchResponse searchScroll(org.elasticsearch.action.search.SearchScrollRequest request)
- Specified by:
searchScroll
in interfaceESClient
-
get
public org.elasticsearch.action.get.GetResponse get(org.elasticsearch.action.get.GetRequest request)
-
index
public org.elasticsearch.action.index.IndexResponse index(org.elasticsearch.action.index.IndexRequest request)
Description copied from interface:ESClient
Performs the indexing request.
-
getScopedSpan
protected io.opencensus.common.Scope getScopedSpan(String name, String request)
-
clearScroll
public org.elasticsearch.action.search.ClearScrollResponse clearScroll(org.elasticsearch.action.search.ClearScrollRequest request)
- Specified by:
clearScroll
in interfaceESClient
-
bulkProcessorBuilder
public org.elasticsearch.action.bulk.BulkProcessor.Builder bulkProcessorBuilder(org.elasticsearch.action.bulk.BulkProcessor.Listener bulkListener)
Description copied from interface:ESClient
Creates an elasticsearch BulkProcessor builder.- Specified by:
bulkProcessorBuilder
in interfaceESClient
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
-