public class ElasticSearchAdminImpl extends Object implements ElasticSearchAdmin
| Modifier and Type | Field and Description | 
|---|---|
protected ESClient | 
client  | 
protected ElasticSearchClientConfig | 
clientConfig  | 
protected ElasticSearchEmbeddedNode | 
embeddedServer  | 
protected ElasticSearchEmbeddedServerConfig | 
embeddedServerConfig  | 
protected String[] | 
excludeSourceFields  | 
protected String[] | 
includeSourceFields  | 
protected Map<String,ElasticSearchIndexConfig> | 
indexConfig  | 
protected boolean | 
indexInitDone  | 
protected Map<String,String> | 
indexNames  | 
protected Map<String,String> | 
repoNames  | 
protected List<String> | 
repositoryInitialized  | 
protected static int | 
TIMEOUT_DELETE_SECOND  | 
protected static int | 
TIMEOUT_WAIT_FOR_CLUSTER_SECOND  | 
protected AtomicInteger | 
totalCommandProcessed  | 
protected Map<String,String> | 
writeIndexNames  | 
| Constructor and Description | 
|---|
ElasticSearchAdminImpl(ElasticSearchEmbeddedServerConfig embeddedServerConfig,
                      ElasticSearchClientConfig clientConfig,
                      Map<String,ElasticSearchIndexConfig> indexConfig)
Init the admin service, remote configuration if not null will take precedence over local embedded configuration. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected void | 
checkClusterHealth(String... indexNames)  | 
protected void | 
checkConfig()  | 
protected void | 
connect()  | 
protected ESClient | 
createClient(ElasticSearchEmbeddedNode node)  | 
void | 
disconnect()  | 
void | 
dropAndInitIndex(String indexName)
Reinitialize an index. 
 | 
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. 
 | 
ESClient | 
getClient()
Retrieves the  
Client that can be used to access Elasticsearch API | 
protected String[] | 
getExcludeSourceFields()  | 
protected String[] | 
getIncludeSourceFields()  | 
String | 
getIndexNameForRepository(String repositoryName)
Get the search index name associated with the repository name. 
 | 
String | 
getIndexNameForType(String type)
Get the first search index name with the given type. 
 | 
List<String> | 
getIndexNamesForType(String type)
Get the index names with the given type. 
 | 
List<String> | 
getInitializedRepositories()
Get the list of repository names that have their index created. 
 | 
long | 
getPendingWorkerCount()
Returns the number of indexing worker scheduled waiting to be executed. 
 | 
String | 
getRepositoryForIndex(String indexName)
Gets the repository name associated with the index. 
 | 
protected Map<String,String> | 
getRepositoryMap()  | 
List<String> | 
getRepositoryNames()
List repository names that have Elasticsearch support. 
 | 
long | 
getRunningWorkerCount()
Returns the number of indexing worker that are currently running. 
 | 
protected String[] | 
getSearchIndexes(List<String> searchRepositories)
Get the elastic search indexes for searches 
 | 
int | 
getTotalCommandProcessed()
Returns the total number of command processed by Elasticsearch for this Nuxeo instance. 
 | 
String | 
getWriteIndexName(String searchIndexName)
Returns the index to use for any write operations. 
 | 
protected void | 
initializeIndexes()  | 
protected void | 
initIndex(ElasticSearchIndexConfig conf,
         boolean dropIfExists)  | 
protected void | 
initIndex(ElasticSearchIndexConfig conf,
         boolean dropIfExists,
         boolean syncAlias)  | 
protected void | 
initIndex(String indexName,
         ElasticSearchIndexConfig conf,
         boolean dropIfExists)  | 
void | 
initIndexes(boolean dropIfExists)
Initialize Elasticsearch indexes. 
 | 
protected void | 
initSearchAlias(ElasticSearchIndexConfig conf)  | 
protected void | 
initWriteAlias(ElasticSearchIndexConfig conf,
              boolean dropIfExists)  | 
boolean | 
isEmbedded()
Returns true if the Elasticsearch is embedded with Nuxeo, sharing the same JVM. 
 | 
boolean | 
isIndexingInProgress()
Returns true if there are indexing activities scheduled or running. 
 | 
boolean | 
isReady()  | 
void | 
optimize()
Elasticsearch run  
ElasticSearchAdmin.optimizeRepositoryIndex(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> | 
prepareWaitForIndexing()
A  
Future 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. 
 | 
protected void | 
syncSearchAndWriteAlias(ElasticSearchIndexConfig conf)
Update the search index to point to the write index. 
 | 
void | 
syncSearchAndWriteAlias(String searchIndexName)
Make sure that the search alias point to the same index as the write alias. 
 | 
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. 
 | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdropAndInitRepositoryIndexprotected static final int TIMEOUT_WAIT_FOR_CLUSTER_SECOND
protected static final int TIMEOUT_DELETE_SECOND
protected final AtomicInteger totalCommandProcessed
protected final Map<String,String> indexNames
protected final Map<String,String> writeIndexNames
protected final Map<String,ElasticSearchIndexConfig> indexConfig
protected final ElasticSearchEmbeddedServerConfig embeddedServerConfig
protected final ElasticSearchClientConfig clientConfig
protected ElasticSearchEmbeddedNode embeddedServer
protected boolean indexInitDone
protected String[] includeSourceFields
protected String[] excludeSourceFields
protected List<String> repositoryInitialized
public ElasticSearchAdminImpl(ElasticSearchEmbeddedServerConfig embeddedServerConfig, ElasticSearchClientConfig clientConfig, Map<String,ElasticSearchIndexConfig> indexConfig)
protected void checkConfig()
protected void connect()
public void disconnect()
protected ESClient createClient(ElasticSearchEmbeddedNode node)
protected void checkClusterHealth(String... indexNames)
protected void initializeIndexes()
public void refreshRepositoryIndex(String repositoryName)
ElasticSearchAdminrefreshRepositoryIndex in interface ElasticSearchAdminpublic String getIndexNameForRepository(String repositoryName)
ElasticSearchAdmingetIndexNameForRepository in interface ElasticSearchAdminpublic String getRepositoryForIndex(String indexName)
ElasticSearchAdmingetRepositoryForIndex in interface ElasticSearchAdminpublic List<String> getIndexNamesForType(String type)
ElasticSearchAdmingetIndexNamesForType in interface ElasticSearchAdminpublic String getIndexNameForType(String type)
ElasticSearchAdmingetIndexNameForType in interface ElasticSearchAdminpublic String getWriteIndexName(String searchIndexName)
ElasticSearchAdmingetWriteIndexName in interface ElasticSearchAdminpublic void syncSearchAndWriteAlias(String searchIndexName)
ElasticSearchAdminsyncSearchAndWriteAlias in interface ElasticSearchAdminpublic void flushRepositoryIndex(String repositoryName)
ElasticSearchAdminflushRepositoryIndex in interface ElasticSearchAdminpublic void refresh()
ElasticSearchAdminrefresh in interface ElasticSearchAdminpublic void flush()
ElasticSearchAdminflush in interface ElasticSearchAdminpublic void optimizeIndex(String indexName)
ElasticSearchAdminoptimizeIndex in interface ElasticSearchAdminpublic void optimizeRepositoryIndex(String repositoryName)
ElasticSearchAdminoptimizeRepositoryIndex in interface ElasticSearchAdminpublic void optimize()
ElasticSearchAdminElasticSearchAdmin.optimizeRepositoryIndex(java.lang.String) on all document indexes,optimize in interface ElasticSearchAdminpublic ESClient getClient()
ElasticSearchAdminClient that can be used to access Elasticsearch APIgetClient in interface ElasticSearchAdminpublic void initIndexes(boolean dropIfExists)
ElasticSearchAdmininitIndexes in interface ElasticSearchAdmindropIfExists - if {true} remove an existing indexpublic void dropAndInitIndex(String indexName)
ElasticSearchAdmindropAndInitIndex in interface ElasticSearchAdminpublic void dropAndInitRepositoryIndex(String repositoryName, boolean syncAlias)
ElasticSearchAdminElasticSearchAdmin.syncSearchAndWriteAlias(String)dropAndInitRepositoryIndex in interface ElasticSearchAdminpublic List<String> getRepositoryNames()
ElasticSearchAdmingetRepositoryNames in interface ElasticSearchAdminprotected void initIndex(ElasticSearchIndexConfig conf, boolean dropIfExists)
protected void initIndex(ElasticSearchIndexConfig conf, boolean dropIfExists, boolean syncAlias)
protected void initWriteAlias(ElasticSearchIndexConfig conf, boolean dropIfExists)
protected void initSearchAlias(ElasticSearchIndexConfig conf)
protected void syncSearchAndWriteAlias(ElasticSearchIndexConfig conf)
protected void initIndex(String indexName, ElasticSearchIndexConfig conf, boolean dropIfExists)
public long getPendingWorkerCount()
ElasticSearchAdmingetPendingWorkerCount in interface ElasticSearchAdminpublic long getRunningWorkerCount()
ElasticSearchAdmingetRunningWorkerCount in interface ElasticSearchAdminpublic int getTotalCommandProcessed()
ElasticSearchAdmingetTotalCommandProcessed in interface ElasticSearchAdminpublic boolean isEmbedded()
ElasticSearchAdminisEmbedded in interface ElasticSearchAdminpublic boolean useExternalVersion()
ElasticSearchAdminuseExternalVersion in interface ElasticSearchAdminpublic boolean isIndexingInProgress()
ElasticSearchAdminisIndexingInProgress in interface ElasticSearchAdminpublic com.google.common.util.concurrent.ListenableFuture<Boolean> prepareWaitForIndexing()
ElasticSearchAdminFuture that accepts callback on completion when all the indexing worker are done.prepareWaitForIndexing in interface ElasticSearchAdminprotected String[] getSearchIndexes(List<String> searchRepositories)
public boolean isReady()
protected String[] getIncludeSourceFields()
protected String[] getExcludeSourceFields()
protected Map<String,String> getRepositoryMap()
public List<String> getInitializedRepositories()
Copyright © 2019 Nuxeo. All rights reserved.