public class ElasticSearchComponent extends DefaultComponent implements ElasticSearchAdmin, ElasticSearchIndexing, ElasticSearchService
| Constructor and Description |
|---|
ElasticSearchComponent() |
| Modifier and Type | Method and Description |
|---|---|
void |
applicationStarted(ComponentContext context)
Notify the component that Nuxeo Framework finished starting all Nuxeo bundles.
|
void |
deactivate(ComponentContext context)
Deactivates the component.
|
void |
dropAndInitRepositoryIndex(String repositoryName)
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.
|
int |
getApplicationStartedOrder()
The component notification order for
Component.applicationStarted(org.nuxeo.runtime.model.ComponentContext). |
org.elasticsearch.client.Client |
getClient()
Retrieves the
Client that can be used to access Elasticsearch API |
String |
getIndexNameForRepository(String repositoryName)
Get the index name associated with the repository name.
|
int |
getPendingCommandCount()
Returns the number of command scheduled for indexing.
|
int |
getPendingWorkerCount()
Returns the number of indexing worker pending waiting to be executed.
|
List<String> |
getRepositoryNames()
List repository names that have Elasticsearch support.
|
int |
getRunningWorkerCount()
Returns the number of indexing worker that are currently running.
|
int |
getTotalCommandProcessed()
Returns the total number of command processed by Elasticsearch.
|
void |
indexNonRecursive(IndexingCommand cmd)
Process the
IndexingCommand. |
void |
indexNonRecursive(List<IndexingCommand> cmds)
Same as
ElasticSearchIndexing.indexNonRecursive(org.nuxeo.elasticsearch.commands.IndexingCommand) but
process the list command using a bulk request. |
void |
initIndexes(boolean dropIfExists)
Initialize Elasticsearch indexes.
|
boolean |
isAlreadyScheduled(IndexingCommand cmd)
{true} if a command has already been submitted for indexing.
|
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.
|
void |
optimize()
Elasticsearch run
ElasticSearchAdmin.optimizeRepositoryIndex(java.lang.String) on all document indexes, |
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. |
DocumentModelList |
query(CoreSession session,
org.elasticsearch.index.query.QueryBuilder queryBuilder,
int limit,
int offset,
SortInfo... sortInfos)
Deprecated.
|
DocumentModelList |
query(CoreSession session,
String nxql,
int limit,
int offset,
SortInfo... sortInfos)
Deprecated.
|
DocumentModelList |
query(NxQueryBuilder queryBuilder)
Returns a document list using an
NxQueryBuilder. |
EsResult |
queryAndAggregate(NxQueryBuilder queryBuilder)
Returns documents and aggregates.
|
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 |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
void |
runIndexingWorker(List<IndexingCommand> cmds)
Run a worker to process the
IndexingCommand. |
void |
runReindexingWorker(String repositoryName,
String nxql)
Reindex documents matching the NXQL query, This is asynchronous.
|
activate, getAdapter, getLastModified, registerExtension, setLastModified, unregisterContribution, unregisterExtensionpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution in class DefaultComponentpublic void applicationStarted(ComponentContext context)
ComponentapplicationStarted in interface ComponentapplicationStarted in class DefaultComponentpublic void deactivate(ComponentContext context)
ComponentThis method is called by the runtime when a component is deactivated.
deactivate in interface Componentdeactivate in class DefaultComponentcontext - the runtime contextpublic int getApplicationStartedOrder()
ComponentComponent.applicationStarted(org.nuxeo.runtime.model.ComponentContext).
Components are notified in increasing order. Order 1000 is the default order for components that don't care. Order 100 is the repository initialization.
getApplicationStartedOrder in interface ComponentgetApplicationStartedOrder in class DefaultComponentpublic org.elasticsearch.client.Client 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 dropAndInitRepositoryIndex(String repositoryName)
ElasticSearchAdmindropAndInitRepositoryIndex in interface ElasticSearchAdminpublic List<String> getRepositoryNames()
ElasticSearchAdmingetRepositoryNames in interface ElasticSearchAdminpublic String getIndexNameForRepository(String repositoryName)
ElasticSearchAdmingetIndexNameForRepository in interface ElasticSearchAdminpublic int getPendingCommandCount()
ElasticSearchAdmingetPendingCommandCount in interface ElasticSearchAdminpublic int getPendingWorkerCount()
ElasticSearchAdmingetPendingWorkerCount in interface ElasticSearchAdminpublic int getRunningWorkerCount()
ElasticSearchAdmingetRunningWorkerCount in interface ElasticSearchAdminpublic int getTotalCommandProcessed()
ElasticSearchAdmingetTotalCommandProcessed in interface ElasticSearchAdminpublic boolean isEmbedded()
ElasticSearchAdminisEmbedded 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 ElasticSearchAdminpublic void refresh()
ElasticSearchAdminrefresh in interface ElasticSearchAdminpublic void refreshRepositoryIndex(String repositoryName)
ElasticSearchAdminrefreshRepositoryIndex in interface ElasticSearchAdminpublic void flush()
ElasticSearchAdminflush in interface ElasticSearchAdminpublic void flushRepositoryIndex(String repositoryName)
ElasticSearchAdminflushRepositoryIndex in interface ElasticSearchAdminpublic void optimize()
ElasticSearchAdminElasticSearchAdmin.optimizeRepositoryIndex(java.lang.String) on all document indexes,optimize in interface ElasticSearchAdminpublic void optimizeRepositoryIndex(String repositoryName)
ElasticSearchAdminoptimizeRepositoryIndex in interface ElasticSearchAdminpublic boolean isAlreadyScheduled(IndexingCommand cmd)
ElasticSearchIndexingisAlreadyScheduled in interface ElasticSearchIndexingpublic void indexNonRecursive(IndexingCommand cmd) throws ClientException
ElasticSearchIndexingIndexingCommand.
Send indexing command to Elasticsearch, if the command is synchronous the index is refreshed so the document is searchable immediately. Recursive indexing is not taken in account except for deletion. This is not a transactional operation, a rollback will not discard the executed commands.
indexNonRecursive in interface ElasticSearchIndexingClientExceptionpublic void indexNonRecursive(List<IndexingCommand> cmds) throws ClientException
ElasticSearchIndexingElasticSearchIndexing.indexNonRecursive(org.nuxeo.elasticsearch.commands.IndexingCommand) but
process the list command using a bulk request.indexNonRecursive in interface ElasticSearchIndexingClientExceptionpublic void runIndexingWorker(List<IndexingCommand> cmds)
ElasticSearchIndexingIndexingCommand.
Asynchronous command schedules an indexing job and return.
Synchronous command execute an indexing job using a new Tx then refresh the index so the document is searchable immediately. if the command is also recursive the children are processed asynchronously.
If there is more than one cmd the elasticsearch request is done in bulk mode.
runIndexingWorker in interface ElasticSearchIndexingpublic void runReindexingWorker(String repositoryName, String nxql)
ElasticSearchIndexingrunReindexingWorker in interface ElasticSearchIndexingpublic DocumentModelList query(NxQueryBuilder queryBuilder) throws ClientException
ElasticSearchServiceNxQueryBuilder.query in interface ElasticSearchServiceClientExceptionpublic EsResult queryAndAggregate(NxQueryBuilder queryBuilder) throws ClientException
ElasticSearchServicequeryAndAggregate in interface ElasticSearchServiceClientException@Deprecated public DocumentModelList query(CoreSession session, String nxql, int limit, int offset, SortInfo... sortInfos) throws ClientException
ElasticSearchServicequery in interface ElasticSearchServiceClientException@Deprecated public DocumentModelList query(CoreSession session, org.elasticsearch.index.query.QueryBuilder queryBuilder, int limit, int offset, SortInfo... sortInfos) throws ClientException
ElasticSearchServiceQueryBuilder. Fetch documents from the VCS repository.query in interface ElasticSearchServiceClientExceptionCopyright © 2015 Nuxeo SA. All rights reserved.