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 |
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 |
int |
getPendingCommands()
Returns the number of indexing command that are waiting to be processed.
|
int |
getPendingDocs()
Returns the number of documents that are waiting for being indexed.
|
int |
getRunningCommands()
Returns the number of indexing command that are currently running
|
int |
getTotalCommandProcessed()
Returns the total number of command processed by Elasticsearch.
|
void |
indexNow(IndexingCommand cmd)
Ask to process the
IndexingCommand . |
void |
indexNow(List<IndexingCommand> cmds)
Ask to process a list of
IndexingCommand . |
void |
initIndexes(boolean dropIfExists)
Initialize Elasticsearch indexes.
|
boolean |
isAlreadyScheduled(IndexingCommand cmd)
{true} if a command has already been submitted for indexing.
|
boolean |
isIndexingInProgress()
Returns true if there are indexing activities.
|
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 |
scheduleIndexing(IndexingCommand cmd)
Schedule indexing command and return.
|
activate, getAdapter, getLastModified, registerExtension, setLastModified, unregisterContribution, unregisterExtension
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) throws Exception
registerContribution
in class DefaultComponent
Exception
public void applicationStarted(ComponentContext context) throws Exception
Component
applicationStarted
in interface Component
applicationStarted
in class DefaultComponent
Exception
public void deactivate(ComponentContext context) throws Exception
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextException
- if an error occurs during activationpublic int getApplicationStartedOrder()
Component
Component.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 Component
getApplicationStartedOrder
in class DefaultComponent
public org.elasticsearch.client.Client getClient()
ElasticSearchAdmin
Client
that can be used to access Elasticsearch APIgetClient
in interface ElasticSearchAdmin
public void initIndexes(boolean dropIfExists)
ElasticSearchAdmin
initIndexes
in interface ElasticSearchAdmin
dropIfExists
- if {true} remove an existing indexpublic int getPendingDocs()
ElasticSearchAdmin
getPendingDocs
in interface ElasticSearchAdmin
public int getPendingCommands()
ElasticSearchAdmin
getPendingCommands
in interface ElasticSearchAdmin
public int getRunningCommands()
ElasticSearchAdmin
getRunningCommands
in interface ElasticSearchAdmin
public int getTotalCommandProcessed()
ElasticSearchAdmin
getTotalCommandProcessed
in interface ElasticSearchAdmin
public boolean isIndexingInProgress()
ElasticSearchAdmin
isIndexingInProgress
in interface ElasticSearchAdmin
public void refresh()
ElasticSearchAdmin
refresh
in interface ElasticSearchAdmin
public void refreshRepositoryIndex(String repositoryName)
ElasticSearchAdmin
refreshRepositoryIndex
in interface ElasticSearchAdmin
public void flush()
ElasticSearchAdmin
flush
in interface ElasticSearchAdmin
public void flushRepositoryIndex(String repositoryName)
ElasticSearchAdmin
flushRepositoryIndex
in interface ElasticSearchAdmin
public void scheduleIndexing(IndexingCommand cmd) throws ClientException
ElasticSearchIndexing
scheduleIndexing
in interface ElasticSearchIndexing
ClientException
public boolean isAlreadyScheduled(IndexingCommand cmd)
ElasticSearchIndexing
isAlreadyScheduled
in interface ElasticSearchIndexing
public void indexNow(IndexingCommand cmd) throws ClientException
ElasticSearchIndexing
IndexingCommand
.
Recursive indexing is not taken in account.indexNow
in interface ElasticSearchIndexing
ClientException
public void indexNow(List<IndexingCommand> cmds) throws ClientException
ElasticSearchIndexing
IndexingCommand
.
Commands list will be processed in bulk mode.
Recursive indexing is not taken in account.indexNow
in interface ElasticSearchIndexing
ClientException
public DocumentModelList query(NxQueryBuilder queryBuilder) throws ClientException
ElasticSearchService
NxQueryBuilder
.query
in interface ElasticSearchService
ClientException
public EsResult queryAndAggregate(NxQueryBuilder queryBuilder) throws ClientException
ElasticSearchService
queryAndAggregate
in interface ElasticSearchService
ClientException
@Deprecated public DocumentModelList query(CoreSession session, String nxql, int limit, int offset, SortInfo... sortInfos) throws ClientException
ElasticSearchService
query
in interface ElasticSearchService
ClientException
@Deprecated public DocumentModelList query(CoreSession session, org.elasticsearch.index.query.QueryBuilder queryBuilder, int limit, int offset, SortInfo... sortInfos) throws ClientException
ElasticSearchService
QueryBuilder
.
Fetch documents from the VCS repository.query
in interface ElasticSearchService
ClientException
Copyright © 2014 Nuxeo SA. All rights reserved.