Package de.cxp.ocs.elasticsearch
Class ElasticsearchIndexer
java.lang.Object
de.cxp.ocs.indexer.AbstractIndexer
de.cxp.ocs.elasticsearch.ElasticsearchIndexer
- All Implemented Interfaces:
FullIndexationService
,UpdateIndexService
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.cxp.ocs.api.indexer.UpdateIndexService
UpdateIndexService.Result
-
Constructor Summary
ConstructorsConstructorDescriptionElasticsearchIndexer
(IndexSettings settings, FieldConfigIndex fieldConfAccess, org.elasticsearch.client.RestHighLevelClient restClient, List<DocumentPreProcessor> preProcessors, List<DocumentPostProcessor> postProcessors) -
Method Summary
Modifier and TypeMethodDescriptionprotected Document
protected UpdateIndexService.Result
_patch
(String index, IndexableItem doc) protected UpdateIndexService.Result
_put
(String indexName, Boolean replaceExisting, IndexableItem doc) protected int
addToIndex
(ImportSession session, List<IndexableItem> bulk) protected void
cleanupAbandonedImports
(String indexName, int minAgeSeconds) deleteDocuments
(String indexName, List<String> ids) Delete existing document.protected void
deleteIndex
(String indexName) boolean
deploy
(ImportSession session) boolean
indexExists
(String indexName) protected String
initNewIndex
(String indexName, String locale) checks to which actual index this "nice indexName (alias)" points to.boolean
isImportRunning
(String indexName) Checks if an active import session exists for that index.protected void
validateSession
(ImportSession session) Methods inherited from class de.cxp.ocs.indexer.AbstractIndexer
add, cancel, done, patchDocument, patchDocuments, putDocument, putDocuments, putDocuments, startImport
-
Constructor Details
-
ElasticsearchIndexer
public ElasticsearchIndexer(IndexSettings settings, FieldConfigIndex fieldConfAccess, org.elasticsearch.client.RestHighLevelClient restClient, List<DocumentPreProcessor> preProcessors, List<DocumentPostProcessor> postProcessors)
-
-
Method Details
-
indexExists
- Specified by:
indexExists
in classAbstractIndexer
-
isImportRunning
Description copied from class:AbstractIndexer
Checks if an active import session exists for that index.
This could either be the full internal or the minimal/final index name.
- Specified by:
isImportRunning
in classAbstractIndexer
- Parameters:
indexName
- internal or external index name- Returns:
-
initNewIndex
checks to which actual index this "nice indexName (alias)" points to. Expects a indexName ending with a number and will return a new index name- Specified by:
initNewIndex
in classAbstractIndexer
- Throws:
IOException
-
validateSession
- Specified by:
validateSession
in classAbstractIndexer
- Throws:
IllegalArgumentException
-
addToIndex
- Specified by:
addToIndex
in classAbstractIndexer
- Throws:
Exception
-
deploy
- Specified by:
deploy
in classAbstractIndexer
-
deleteIndex
- Specified by:
deleteIndex
in classAbstractIndexer
-
_patch
- Specified by:
_patch
in classAbstractIndexer
-
_put
protected UpdateIndexService.Result _put(String indexName, Boolean replaceExisting, IndexableItem doc) - Specified by:
_put
in classAbstractIndexer
-
deleteDocuments
Description copied from interface:UpdateIndexService
Delete existing document. If document does not exist, it returns code 404.- Parameters:
indexName
- name of the index that should receive that updateids
- Array of IDs of the documents that should be deleted- Returns:
- Result code, one of DELETED, NOT_FOUND
-
_get
- Specified by:
_get
in classAbstractIndexer
-
cleanupAbandonedImports
- Specified by:
cleanupAbandonedImports
in classAbstractIndexer
-