Package org.nuxeo.elasticsearch.client
Class ESRestClient
java.lang.Object
org.nuxeo.elasticsearch.client.ESRestClient
- All Implemented Interfaces:
AutoCloseable
,ESClient
- Since:
- 9.3
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Exception when Elastic is overloaded by indexing requests. -
Field Summary
-
Constructor Summary
ConstructorDescriptionESRestClient
(org.opensearch.client.RestClient lowLevelRestClient, org.opensearch.client.RestHighLevelClient client) -
Method Summary
Modifier and TypeMethodDescriptionboolean
aliasExists
(String aliasName) org.opensearch.action.bulk.BulkResponse
bulk
(org.opensearch.action.bulk.BulkRequest request) org.opensearch.action.bulk.BulkProcessor.Builder
bulkProcessorBuilder
(org.opensearch.action.bulk.BulkProcessor.Listener bulkListener) Creates an elasticsearch BulkProcessor builder.org.opensearch.action.search.ClearScrollResponse
clearScroll
(org.opensearch.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.opensearch.action.delete.DeleteResponse
delete
(org.opensearch.action.delete.DeleteRequest request) protected void
deleteAlias
(String aliasName) void
deleteIndex
(String indexName, int timeoutSecond) protected org.opensearch.action.bulk.BulkResponse
doBulk
(org.opensearch.action.bulk.BulkRequest request) protected org.opensearch.action.delete.DeleteResponse
doDelete
(org.opensearch.action.delete.DeleteRequest request) protected org.opensearch.action.index.IndexResponse
doIndex
(org.opensearch.action.index.IndexRequest request) void
org.opensearch.action.get.GetResponse
get
(org.opensearch.action.get.GetRequest request) getFirstIndexForAlias
(String aliasName) Returns the name of the index referenced by the alias.org.opensearch.cluster.health.ClusterHealthStatus
getHealthStatus
(String[] indexNames) protected String
getIndexesAsString
(String[] indexNames) getMapping
(String indexName) Returns the mapping from elastic, exposed for testing purposesprotected io.opencensus.common.Scope
getScopedSpan
(String name, String request) org.opensearch.action.index.IndexResponse
index
(org.opensearch.action.index.IndexRequest request) Performs the indexing request.boolean
indexExists
(String indexName) boolean
mappingExists
(String indexName, String type) void
protected org.opensearch.client.Response
performRequest
(org.opensearch.client.Request request) org.opensearch.client.Response
performRequestWithTracing
(org.opensearch.client.Request request) Performs an Elastic request using the low level client, exposed since 11.5 for internal use only.void
org.opensearch.action.search.SearchResponse
search
(org.opensearch.action.search.SearchRequest request) org.opensearch.action.search.SearchResponse
searchScroll
(org.opensearch.action.search.SearchScrollRequest request) void
updateAlias
(String aliasName, String indexName) boolean
waitForYellowStatus
(String[] indexNames, int timeoutSecond)
-
Field Details
-
LONG_TIMEOUT
- See Also:
-
CREATE_INDEX_TIMEOUT
Deprecated.useLONG_TIMEOUT
instead- See Also:
-
lowLevelClient
protected org.opensearch.client.RestClient lowLevelClient -
client
protected org.opensearch.client.RestHighLevelClient client -
COMPAT_ES_OPTIONS
protected org.opensearch.client.RequestOptions COMPAT_ES_OPTIONS
-
-
Constructor Details
-
ESRestClient
public ESRestClient(org.opensearch.client.RestClient lowLevelRestClient, org.opensearch.client.RestHighLevelClient client)
-
-
Method Details
-
waitForYellowStatus
- Specified by:
waitForYellowStatus
in interfaceESClient
-
getIndexesAsString
-
getHealthStatus
- Specified by:
getHealthStatus
in interfaceESClient
-
refresh
-
flush
-
optimize
-
indexExists
- Specified by:
indexExists
in interfaceESClient
-
mappingExists
- Specified by:
mappingExists
in interfaceESClient
-
deleteIndex
- Specified by:
deleteIndex
in interfaceESClient
-
createIndex
- Specified by:
createIndex
in interfaceESClient
-
createMapping
- Specified by:
createMapping
in interfaceESClient
-
getMapping
Description copied from interface:ESClient
Returns the mapping from elastic, exposed for testing purposes- Specified by:
getMapping
in interfaceESClient
-
performRequest
protected org.opensearch.client.Response performRequest(org.opensearch.client.Request request) -
performRequestWithTracing
public org.opensearch.client.Response performRequestWithTracing(org.opensearch.client.Request request) Performs an Elastic request using the low level client, exposed since 11.5 for internal use only. -
getNodesInfo
- Specified by:
getNodesInfo
in interfaceESClient
-
getNodesStats
- Specified by:
getNodesStats
in interfaceESClient
-
aliasExists
- Specified by:
aliasExists
in interfaceESClient
-
getFirstIndexForAlias
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
- Specified by:
updateAlias
in interfaceESClient
-
deleteAlias
-
createAlias
-
bulk
public org.opensearch.action.bulk.BulkResponse bulk(org.opensearch.action.bulk.BulkRequest request) -
doBulk
protected org.opensearch.action.bulk.BulkResponse doBulk(org.opensearch.action.bulk.BulkRequest request) throws ESRestClient.TooManyRequestsRetryableException -
delete
public org.opensearch.action.delete.DeleteResponse delete(org.opensearch.action.delete.DeleteRequest request) -
doDelete
protected org.opensearch.action.delete.DeleteResponse doDelete(org.opensearch.action.delete.DeleteRequest request) throws ESRestClient.TooManyRequestsRetryableException -
search
public org.opensearch.action.search.SearchResponse search(org.opensearch.action.search.SearchRequest request) -
searchScroll
public org.opensearch.action.search.SearchResponse searchScroll(org.opensearch.action.search.SearchScrollRequest request) - Specified by:
searchScroll
in interfaceESClient
-
get
public org.opensearch.action.get.GetResponse get(org.opensearch.action.get.GetRequest request) -
index
public org.opensearch.action.index.IndexResponse index(org.opensearch.action.index.IndexRequest request) Description copied from interface:ESClient
Performs the indexing request. -
doIndex
protected org.opensearch.action.index.IndexResponse doIndex(org.opensearch.action.index.IndexRequest request) throws ESRestClient.TooManyRequestsRetryableException -
getScopedSpan
-
clearScroll
public org.opensearch.action.search.ClearScrollResponse clearScroll(org.opensearch.action.search.ClearScrollRequest request) - Specified by:
clearScroll
in interfaceESClient
-
bulkProcessorBuilder
public org.opensearch.action.bulk.BulkProcessor.Builder bulkProcessorBuilder(org.opensearch.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
-
LONG_TIMEOUT
instead