Package org.nuxeo.elasticsearch.api
Interface ElasticSearchAdmin
- All Known Implementing Classes:
ElasticSearchAdminImpl
,ElasticSearchComponent
public interface ElasticSearchAdmin
Administration interface for Elasticsearch service
- Since:
- 5.9.3
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dropAndInitIndex
(String indexName) Reinitialize an index.default void
dropAndInitRepositoryIndex
(String repositoryName) Reinitialize the index of a repository.void
dropAndInitRepositoryIndex
(String repositoryName, boolean syncAlias) Reinitialize the index of a repository.void
flush()
Elasticsearch flush on all document indexes, triggers a lucene commit, empties the transaction log.void
flushRepositoryIndex
(String repositoryName) Elasticsearch flush on document index for a specific repository, triggers a lucene commit, empties the transaction log.Retrieves theClient
that can be used to access Elasticsearch APIgetHintByOperator
(String name) Returns the hint by the Elasticsearch operator name.getIndexNameForRepository
(String repositoryName) Get the search index name associated with the repository name.getIndexNameForType
(String type) Get the first search index name with the given type.getIndexNamesForType
(String type) Get the index names with the given type.long
Returns the number of indexing worker scheduled waiting to be executed.getRepositoryForIndex
(String indexName) Gets the repository name associated with the index.List repository names that have Elasticsearch support.long
Returns the number of indexing worker that are currently running.getSecondaryWriteIndexName
(String searchIndexName) Returns the secondary write index used during re-indexing with aliases.int
Returns the total number of command processed by Elasticsearch for this Nuxeo instance.getWriteIndexName
(String searchIndexName) Returns the index to use for any write operations.void
initIndexes
(boolean dropIfExists) Initialize Elasticsearch indexes.void
initRepositoryIndexWithAliases
(String repositoryName) Creates a new index for the repository applying the mapping and settings.boolean
Returns true if the Elasticsearch is embedded with Nuxeo, sharing the same JVM.boolean
Returns true if there are indexing activities scheduled or running.void
optimize()
Elasticsearch runoptimizeRepositoryIndex(java.lang.String)
on all document indexes,void
optimizeIndex
(String indexName) Elasticsearch optimize operation allows to reduce the number of segments to one, Note that this can potentially be a very heavy operation.void
optimizeRepositoryIndex
(String repositoryName) Elasticsearch optimize operation allows to reduce the number of segments to one, Note that this can potentially be a very heavy operation.com.google.common.util.concurrent.ListenableFuture<Boolean>
AFuture
that accepts callback on completion when all the indexing worker are done.void
refresh()
Refresh all document indexes, immediately after the operation occurs, so that the updated document appears in search results immediately.void
refreshRepositoryIndex
(String repositoryName) Refresh document index for the specific repository, immediately after the operation occurs, so that the updated document appears in search results immediately.void
syncSearchAndWriteAlias
(String searchIndexName) Make sure that the search alias point to the same index as the write alias.boolean
When true use an external version for Elasticsearch document, this enable an optimistic concurrency control ensuring that an older version of a document never overwrites a newer version.
-
Method Details
-
getClient
ESClient getClient()Retrieves theClient
that can be used to access Elasticsearch API- Since:
- 5.9.3
-
initIndexes
void initIndexes(boolean dropIfExists) Initialize Elasticsearch indexes. Setup the index settings and mapping for each index that has been registered.- Parameters:
dropIfExists
- if {true} remove an existing index- Since:
- 5.9.3
-
dropAndInitIndex
Reinitialize an index. This will drop the existing index, recreate it with its settings and mapping, the index will be empty.- Since:
- 7.3
-
dropAndInitRepositoryIndex
Reinitialize the index of a repository. This will drop the existing index, recreate it with its settings and mapping, the index will be empty.- Since:
- 7.1
-
dropAndInitRepositoryIndex
Reinitialize the index of a repository. This will drop the existing index, recreate it with its settings and mapping, the index will be empty. When syncAlias is false then search alias is not updated with the new index, you need to explicitly callsyncSearchAndWriteAlias(String)
- Since:
- 9.3
-
initRepositoryIndexWithAliases
Creates a new index for the repository applying the mapping and settings. Update the write alias to point to this new index. The search alias is updated to the new index only for the initial creation. Otherwise, there are two write indexes until an explicit call tosyncSearchAndWriteAlias(String)
.- Since:
- 2021.12
-
getRepositoryNames
List repository names that have Elasticsearch support.- Since:
- 7.1
-
getIndexNameForRepository
Get the search index name associated with the repository name.- Throws:
NoSuchElementException
- if there is no Elasticsearch index associated with the requested repository.- Since:
- 7.2
-
getRepositoryForIndex
Gets the repository name associated with the index.- Since:
- 9.10
-
getIndexNamesForType
Get the index names with the given type.- Since:
- 7.10
-
getIndexNameForType
Get the first search index name with the given type.- Throws:
NoSuchElementException
- if there is no Elasticsearch index with the given type.- Since:
- 7.10
-
getWriteIndexName
Returns the index to use for any write operations.- Since:
- 9.3
-
getSecondaryWriteIndexName
Returns the secondary write index used during re-indexing with aliases.- Returns:
- an index name or null if there is no re-indexing in progress.
- Since:
- 2021.12
-
syncSearchAndWriteAlias
Make sure that the search alias point to the same index as the write alias.- Since:
- 9.3
-
isIndexingInProgress
boolean isIndexingInProgress()Returns true if there are indexing activities scheduled or running.- Since:
- 5.9.5
-
prepareWaitForIndexing
com.google.common.util.concurrent.ListenableFuture<Boolean> prepareWaitForIndexing()AFuture
that accepts callback on completion when all the indexing worker are done.- Since:
- 7.2
-
refresh
void refresh()Refresh all document indexes, immediately after the operation occurs, so that the updated document appears in search results immediately. There is no fsync thus doesn't guarantee durability.- Since:
- 5.9.3
-
refreshRepositoryIndex
Refresh document index for the specific repository, immediately after the operation occurs, so that the updated document appears in search results immediately. There is no fsync thus doesn't guarantee durability.- Since:
- 5.9.4
-
flush
void flush()Elasticsearch flush on all document indexes, triggers a lucene commit, empties the transaction log. Data is flushed to disk.- Since:
- 5.9.3
-
flushRepositoryIndex
Elasticsearch flush on document index for a specific repository, triggers a lucene commit, empties the transaction log. Data is flushed to disk.- Since:
- 5.9.4
-
optimize
void optimize()Elasticsearch runoptimizeRepositoryIndex(java.lang.String)
on all document indexes,- Since:
- 7.2
-
optimizeRepositoryIndex
Elasticsearch optimize operation allows to reduce the number of segments to one, Note that this can potentially be a very heavy operation.- Since:
- 7.2
-
optimizeIndex
Elasticsearch optimize operation allows to reduce the number of segments to one, Note that this can potentially be a very heavy operation.- Since:
- 7.3
-
getPendingWorkerCount
long getPendingWorkerCount()Returns the number of indexing worker scheduled waiting to be executed.- Since:
- 7.1
-
getRunningWorkerCount
long getRunningWorkerCount()Returns the number of indexing worker that are currently running.- Since:
- 7.1
-
getTotalCommandProcessed
int getTotalCommandProcessed()Returns the total number of command processed by Elasticsearch for this Nuxeo instance. Useful for test assertion.- Since:
- 5.9.4
-
isEmbedded
boolean isEmbedded()Returns true if the Elasticsearch is embedded with Nuxeo, sharing the same JVM.- Since:
- 7.2
-
useExternalVersion
boolean useExternalVersion()When true use an external version for Elasticsearch document, this enable an optimistic concurrency control ensuring that an older version of a document never overwrites a newer version.- Since:
- 8.3
-
getHintByOperator
Returns the hint by the Elasticsearch operator name.- Since:
- 11.1
-