Class OpenSearchRestClient
java.lang.Object
org.nuxeo.runtime.opensearch1.client.OpenSearchRestClient
- All Implemented Interfaces:
AutoCloseable
,OpenSearchClient
- Since:
- 9.3
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOpenSearchRestClient
(String id, 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.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 jsonMapping) protected void
deleteAlias
(String aliasName) protected org.opensearch.action.bulk.BulkResponse
doBulk
(org.opensearch.action.bulk.BulkRequest request) protected org.opensearch.action.index.IndexResponse
doIndex
(org.opensearch.action.index.IndexRequest request) void
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.getId()
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) boolean
indexExists
(String indexName) boolean
isReady()
boolean
mappingExists
(String indexName) void
protected <I extends org.opensearch.action.ActionRequest,
O extends org.opensearch.action.ActionResponse>
OperformRequestWithTracing
(ThrowableBiFunction<I, org.opensearch.client.RequestOptions, O, IOException> runner, I request, String spanName) org.opensearch.client.Response
performRequestWithTracing
(org.opensearch.client.Request request) Deprecated, for removal: This API element is subject to removal in a future version.void
org.opensearch.action.search.SearchResponse
scroll
(org.opensearch.action.search.SearchScrollRequest request) org.opensearch.action.search.SearchResponse
search
(org.opensearch.action.search.SearchRequest request) void
updateAlias
(String aliasName, String indexName) boolean
waitForYellowStatus
(String[] indexNames, Duration timeout) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.runtime.opensearch1.client.OpenSearchClient
dropIndex
-
Field Details
-
LONG_TIMEOUT
- See Also:
-
CREATE_INDEX_TIMEOUT
Deprecated.useLONG_TIMEOUT
instead- See Also:
-
id
-
client
protected final org.opensearch.client.RestHighLevelClient client -
COMPAT_ES_OPTIONS
protected org.opensearch.client.RequestOptions COMPAT_ES_OPTIONS
-
-
Constructor Details
-
OpenSearchRestClient
-
-
Method Details
-
getId
- Specified by:
getId
in interfaceOpenSearchClient
- Returns:
- The client id
-
isReady
public boolean isReady()- Specified by:
isReady
in interfaceOpenSearchClient
- Returns:
- Whether the targeted OpenSearch is ready or not (its status is at least
ClusterHealthStatus.YELLOW
-
waitForYellowStatus
- Specified by:
waitForYellowStatus
in interfaceOpenSearchClient
-
getIndexesAsString
-
refresh
- Specified by:
refresh
in interfaceOpenSearchClient
-
flush
- Specified by:
flush
in interfaceOpenSearchClient
-
optimize
- Specified by:
optimize
in interfaceOpenSearchClient
-
createIndex
- Specified by:
createIndex
in interfaceOpenSearchClient
-
indexExists
- Specified by:
indexExists
in interfaceOpenSearchClient
-
dropIndex
- Specified by:
dropIndex
in interfaceOpenSearchClient
-
createMapping
- Specified by:
createMapping
in interfaceOpenSearchClient
-
mappingExists
- Specified by:
mappingExists
in interfaceOpenSearchClient
-
getMapping
Description copied from interface:OpenSearchClient
Returns the mapping from elastic, exposed for testing purposes- Specified by:
getMapping
in interfaceOpenSearchClient
-
createAlias
-
aliasExists
- Specified by:
aliasExists
in interfaceOpenSearchClient
-
getFirstIndexForAlias
Description copied from interface:OpenSearchClient
Returns the name of the index referenced by the alias. Returns null if the alias does not exists.- Specified by:
getFirstIndexForAlias
in interfaceOpenSearchClient
-
updateAlias
- Specified by:
updateAlias
in interfaceOpenSearchClient
-
deleteAlias
-
performRequestWithTracing
@Deprecated(forRemoval=true) public org.opensearch.client.Response performRequestWithTracing(org.opensearch.client.Request request) Deprecated, for removal: This API element is subject to removal in a future version.Performs an OpenSearch request using the low level client, exposed since 11.5 for internal use only. -
index
public org.opensearch.action.index.IndexResponse index(org.opensearch.action.index.IndexRequest request) - Specified by:
index
in interfaceOpenSearchClient
-
doIndex
protected org.opensearch.action.index.IndexResponse doIndex(org.opensearch.action.index.IndexRequest request) throws RetryableException - Throws:
RetryableException
-
bulk
public org.opensearch.action.bulk.BulkResponse bulk(org.opensearch.action.bulk.BulkRequest request) - Specified by:
bulk
in interfaceOpenSearchClient
-
doBulk
protected org.opensearch.action.bulk.BulkResponse doBulk(org.opensearch.action.bulk.BulkRequest request) throws RetryableException - Throws:
RetryableException
-
get
public org.opensearch.action.get.GetResponse get(org.opensearch.action.get.GetRequest request) - Specified by:
get
in interfaceOpenSearchClient
-
search
public org.opensearch.action.search.SearchResponse search(org.opensearch.action.search.SearchRequest request) - Specified by:
search
in interfaceOpenSearchClient
-
scroll
public org.opensearch.action.search.SearchResponse scroll(org.opensearch.action.search.SearchScrollRequest request) - Specified by:
scroll
in interfaceOpenSearchClient
-
clearScroll
public org.opensearch.action.search.ClearScrollResponse clearScroll(org.opensearch.action.search.ClearScrollRequest request) - Specified by:
clearScroll
in interfaceOpenSearchClient
-
performRequestWithTracing
protected <I extends org.opensearch.action.ActionRequest,O extends org.opensearch.action.ActionResponse> O performRequestWithTracing(ThrowableBiFunction<I, org.opensearch.client.RequestOptions, O, IOException> runner, I request, String spanName) -
getScopedSpan
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
LONG_TIMEOUT
instead