Package org.nuxeo.elasticsearch.core
Class ElasticSearchIndexingImpl
- java.lang.Object
-
- org.nuxeo.elasticsearch.core.ElasticSearchIndexingImpl
-
- All Implemented Interfaces:
ElasticSearchIndexing
public class ElasticSearchIndexingImpl extends Object implements ElasticSearchIndexing
- Since:
- 6.0
-
-
Field Summary
Fields Modifier and Type Field Description protected static com.fasterxml.jackson.core.JsonFactory
JSON_FACTORY
-
Constructor Summary
Constructors Constructor Description ElasticSearchIndexingImpl(ElasticSearchAdminImpl esa)
ElasticSearchIndexingImpl(ElasticSearchAdminImpl esa, JsonESDocumentWriter jsonESDocumentWriter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getPathOfDocFromEs(String repository, String indexName, String docId)
Returns the ecm:path of an ES document or null if not found.protected String
getSecondaryWriteIndexForRepository(String repository)
protected String
getWriteIndexForRepository(String repository)
void
indexNonRecursive(List<IndexingCommand> cmds)
Same asElasticSearchIndexing.indexNonRecursive(org.nuxeo.elasticsearch.commands.IndexingCommand)
but process the list command using a bulk request.void
indexNonRecursive(IndexingCommand cmd)
Process theIndexingCommand
.protected void
processIndexRequest(String documentId, org.elasticsearch.action.index.IndexRequest request)
void
reindexRepository(String repositoryName)
Recreate an index and run an async reindexing worker.void
runIndexingWorker(List<IndexingCommand> cmds)
Run a worker to process theIndexingCommand
.void
runReindexingWorker(String repositoryName, String nxql, boolean syncAlias)
Reindex documents matching the NXQL query, This is done in an asynchronous job.org.elasticsearch.common.bytes.BytesReference
source(DocumentModel doc)
Returns the JSON Elasticsearch source representation of a document.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.elasticsearch.api.ElasticSearchIndexing
runReindexingWorker
-
-
-
-
Constructor Detail
-
ElasticSearchIndexingImpl
public ElasticSearchIndexingImpl(ElasticSearchAdminImpl esa)
-
ElasticSearchIndexingImpl
public ElasticSearchIndexingImpl(ElasticSearchAdminImpl esa, JsonESDocumentWriter jsonESDocumentWriter)
- Since:
- 7.2
-
-
Method Detail
-
runIndexingWorker
public void runIndexingWorker(List<IndexingCommand> cmds)
Description copied from interface:ElasticSearchIndexing
Run a worker to process theIndexingCommand
.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.
- Specified by:
runIndexingWorker
in interfaceElasticSearchIndexing
-
runReindexingWorker
public void runReindexingWorker(String repositoryName, String nxql, boolean syncAlias)
Description copied from interface:ElasticSearchIndexing
Reindex documents matching the NXQL query, This is done in an asynchronous job. When syncAlias is true a call is made to sync the search alias with write alias once indexing is done.- Specified by:
runReindexingWorker
in interfaceElasticSearchIndexing
-
reindexRepository
public void reindexRepository(String repositoryName)
Description copied from interface:ElasticSearchIndexing
Recreate an index and run an async reindexing worker.- Specified by:
reindexRepository
in interfaceElasticSearchIndexing
-
indexNonRecursive
public void indexNonRecursive(List<IndexingCommand> cmds)
Description copied from interface:ElasticSearchIndexing
Same asElasticSearchIndexing.indexNonRecursive(org.nuxeo.elasticsearch.commands.IndexingCommand)
but process the list command using a bulk request.- Specified by:
indexNonRecursive
in interfaceElasticSearchIndexing
-
indexNonRecursive
public void indexNonRecursive(IndexingCommand cmd)
Description copied from interface:ElasticSearchIndexing
Process theIndexingCommand
.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.
- Specified by:
indexNonRecursive
in interfaceElasticSearchIndexing
-
processIndexRequest
protected void processIndexRequest(String documentId, org.elasticsearch.action.index.IndexRequest request)
-
getPathOfDocFromEs
protected String getPathOfDocFromEs(String repository, String indexName, String docId)
Returns the ecm:path of an ES document or null if not found.- Since:
- 2021.12
-
getSecondaryWriteIndexForRepository
protected String getSecondaryWriteIndexForRepository(String repository)
-
source
public org.elasticsearch.common.bytes.BytesReference source(DocumentModel doc) throws IOException
Description copied from interface:ElasticSearchIndexing
Returns the JSON Elasticsearch source representation of a document.- Specified by:
source
in interfaceElasticSearchIndexing
- Throws:
IOException
-
-