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
public class ElasticsearchIndexer extends AbstractIndexer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.cxp.ocs.api.indexer.UpdateIndexService
UpdateIndexService.Result
-
-
Constructor Summary
Constructors Constructor Description ElasticsearchIndexer(IndexSettings settings, FieldConfigIndex fieldConfAccess, org.elasticsearch.client.RestHighLevelClient restClient, List<DocumentPreProcessor> preProcessors, List<DocumentPostProcessor> postProcessors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Document_get(String indexName, @NonNull String id)protected UpdateIndexService.Result_patch(String index, IndexableItem doc)protected UpdateIndexService.Result_put(String indexName, Boolean replaceExisting, IndexableItem doc)protected intaddToIndex(ImportSession session, List<IndexableItem> bulk)Map<String,UpdateIndexService.Result>deleteDocuments(String indexName, List<String> ids)Delete existing document.voiddeleteIndex(String indexName)booleandeploy(ImportSession session)protected StringinitNewIndex(String indexName, String locale)checks to which actual index this "nice indexName (alias)" points to.booleanisImportRunning(String indexName)protected voidvalidateSession(ImportSession session)-
Methods inherited from class de.cxp.ocs.indexer.AbstractIndexer
add, cancel, done, patchDocument, patchDocuments, putDocument, putDocuments, startImport
-
-
-
-
Constructor Detail
-
ElasticsearchIndexer
public ElasticsearchIndexer(IndexSettings settings, FieldConfigIndex fieldConfAccess, org.elasticsearch.client.RestHighLevelClient restClient, List<DocumentPreProcessor> preProcessors, List<DocumentPostProcessor> postProcessors)
-
-
Method Detail
-
isImportRunning
public boolean isImportRunning(String indexName)
- Specified by:
isImportRunningin classAbstractIndexer
-
initNewIndex
protected String initNewIndex(String indexName, String locale) throws IOException
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:
initNewIndexin classAbstractIndexer- Throws:
IOException
-
validateSession
protected void validateSession(ImportSession session) throws IllegalArgumentException
- Specified by:
validateSessionin classAbstractIndexer- Throws:
IllegalArgumentException
-
addToIndex
protected int addToIndex(ImportSession session, List<IndexableItem> bulk) throws Exception
- Specified by:
addToIndexin classAbstractIndexer- Throws:
Exception
-
deploy
public boolean deploy(ImportSession session)
- Specified by:
deployin classAbstractIndexer
-
deleteIndex
public void deleteIndex(String indexName)
- Specified by:
deleteIndexin classAbstractIndexer
-
_patch
protected UpdateIndexService.Result _patch(String index, IndexableItem doc)
- Specified by:
_patchin classAbstractIndexer
-
_put
protected UpdateIndexService.Result _put(String indexName, Boolean replaceExisting, IndexableItem doc)
- Specified by:
_putin classAbstractIndexer
-
deleteDocuments
public Map<String,UpdateIndexService.Result> deleteDocuments(String indexName, List<String> ids)
Description copied from interface:UpdateIndexServiceDelete 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
protected Document _get(String indexName, @NonNull @NonNull String id)
- Specified by:
_getin classAbstractIndexer
-
-