Package com.flowable.indexing.impl
Class IndexingServiceImpl
java.lang.Object
com.flowable.indexing.impl.IndexingServiceImpl
- All Implemented Interfaces:
IndexingService,LowLevelIndexingService
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.flowable.indexing.api.LowLevelIndexingService
LowLevelIndexingService.BulkIndexRequestConflictHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SpringAsyncHistoryExecutorprotected List<BulkIndexRequestInterceptor>protected ElasticsearchClientprotected booleanprotected IndexManagerprotected com.fasterxml.jackson.databind.ObjectMapperprotected ObjectSerializationService -
Constructor Summary
ConstructorsConstructorDescriptionIndexingServiceImpl(boolean indexingEnabled, ElasticsearchClient elasticsearchClient, ObjectSerializationService objectSerializationService, IndexManager indexManager, com.fasterxml.jackson.databind.ObjectMapper objectMapper, SpringAsyncHistoryExecutor asyncHistoryExecutor, List<BulkIndexRequestInterceptor> bulkIndexRequestInterceptors) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToCurrentBulkRequestAsFullIndex(CommandContext commandContext, String type, String id, com.fasterxml.jackson.databind.node.ObjectNode data, String idFieldName) Adds theObjectNodedata as a full index (i.e.voidaddToCurrentBulkRequestAsFullIndexWithExternalVersion(CommandContext commandContext, String type, String id, com.fasterxml.jackson.databind.node.ObjectNode data, String idFieldName, LowLevelIndexingService.BulkIndexRequestConflictHandler bulkIndexRequestConflictHandler) Equivalent toLowLevelIndexingService.addToCurrentBulkRequestAsFullIndex(CommandContext, String, String, ObjectNode, String), but using external versioning (vs the one from Elasticsearch).voidaddToCurrentBulkRequestAsUpsert(CommandContext commandContext, String type, com.fasterxml.jackson.databind.node.ObjectNode data, String idFieldName) Adds theObjectNodedata as an upsert (i.e.voidaddToCurrentBulkRequestAsUpsertWithScript(CommandContext commandContext, com.fasterxml.jackson.databind.node.ObjectNode dataNode, com.fasterxml.jackson.databind.node.ObjectNode scriptNode, String idFieldName) Adds theObjectNodedata as an upsert (i.e.protected HistoryJobEntitycreateHistoryJobEntity(String handlerType) voiddeleteByQuery(String aliasName, com.fasterxml.jackson.databind.node.ObjectNode query) Delete indexed objects based on a query.voiddeleteIndexedObject(String aliasName, String id) Delete the indexed object using the provided id.protected StringdetermineIndex(com.fasterxml.jackson.databind.node.ObjectNode objectNode, IndexedDataObject indexedDataObject) protected StringdetermineIndex(IndexMapping indexMapping) voidindexObject(Object object, String idFieldName) Similar toLowLevelIndexingService.indexObject(Object), but by providing an alternative field name that contains the id, instead of depending on theIndexingJsonConstants.PROPERTY_IDin the json.booleanisFullIndexRegisteredOnCurrentBulkRequest(CommandContext commandContext, String type, String id) Returns whether a full index was already registered before during the current transaction.booleanvoidscheduleIndexedObjectDelete(String aliasName, String id) Schedule a delete of an object from an index.voidscheduleIndexing(Object object, String tenantId) Schedule to index a generic object, that will pass theIndexableObjectSerializerfirst.voidscheduleIndexing(String type, com.fasterxml.jackson.databind.node.ObjectNode dataNode, String tenantId) Schedule the json directly to be indexed using the provided type.voidscheduleUpdateByQuery(String mappingType, com.fasterxml.jackson.databind.node.ObjectNode updateByQueryBody) Schedule an update by query with an abitrary body.protected com.fasterxml.jackson.databind.node.ObjectNodeserializeObject(Object object) protected List<IndexedDataObject>transformObjectToIndexedDataObjects(com.fasterxml.jackson.databind.node.ObjectNode objectNode, String idFieldName) voidupdateByQuery(String mappingType, com.fasterxml.jackson.databind.node.ObjectNode data) Perform Update by Query for the given Mapping type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.flowable.indexing.api.LowLevelIndexingService
indexObject
-
Field Details
-
indexingEnabled
protected boolean indexingEnabled -
elasticsearchClient
-
objectSerializationService
-
indexManager
-
objectMapper
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper -
asyncHistoryExecutor
-
bulkIndexRequestInterceptors
-
-
Constructor Details
-
IndexingServiceImpl
public IndexingServiceImpl(boolean indexingEnabled, ElasticsearchClient elasticsearchClient, ObjectSerializationService objectSerializationService, IndexManager indexManager, com.fasterxml.jackson.databind.ObjectMapper objectMapper, SpringAsyncHistoryExecutor asyncHistoryExecutor, List<BulkIndexRequestInterceptor> bulkIndexRequestInterceptors)
-
-
Method Details
-
isIndexingEnabled
public boolean isIndexingEnabled()- Specified by:
isIndexingEnabledin interfaceIndexingService
-
indexObject
Description copied from interface:LowLevelIndexingServiceSimilar toLowLevelIndexingService.indexObject(Object), but by providing an alternative field name that contains the id, instead of depending on theIndexingJsonConstants.PROPERTY_IDin the json. Deprecated: This method will be removed in a future version.- Specified by:
indexObjectin interfaceLowLevelIndexingService
-
transformObjectToIndexedDataObjects
protected List<IndexedDataObject> transformObjectToIndexedDataObjects(com.fasterxml.jackson.databind.node.ObjectNode objectNode, String idFieldName) -
serializeObject
-
scheduleIndexing
Description copied from interface:IndexingServiceSchedule to index a generic object, that will pass theIndexableObjectSerializerfirst.- Specified by:
scheduleIndexingin interfaceIndexingService
-
scheduleIndexing
public void scheduleIndexing(String type, com.fasterxml.jackson.databind.node.ObjectNode dataNode, String tenantId) Description copied from interface:IndexingServiceSchedule the json directly to be indexed using the provided type.- Specified by:
scheduleIndexingin interfaceIndexingService
-
deleteIndexedObject
Description copied from interface:LowLevelIndexingServiceDelete the indexed object using the provided id.- Specified by:
deleteIndexedObjectin interfaceLowLevelIndexingService
-
deleteByQuery
Description copied from interface:LowLevelIndexingServiceDelete indexed objects based on a query.- Specified by:
deleteByQueryin interfaceLowLevelIndexingService
-
scheduleUpdateByQuery
public void scheduleUpdateByQuery(String mappingType, com.fasterxml.jackson.databind.node.ObjectNode updateByQueryBody) Description copied from interface:IndexingServiceSchedule an update by query with an abitrary body. The mappingType parameter is used to determine which indexes this will be applied to.- Specified by:
scheduleUpdateByQueryin interfaceIndexingService
-
updateByQuery
Description copied from interface:LowLevelIndexingServicePerform Update by Query for the given Mapping type.- Specified by:
updateByQueryin interfaceLowLevelIndexingService- Parameters:
mappingType- the type of the mapping for which the update should be donedata- the update by query request data
-
scheduleIndexedObjectDelete
Description copied from interface:IndexingServiceSchedule a delete of an object from an index.- Specified by:
scheduleIndexedObjectDeletein interfaceIndexingService
-
addToCurrentBulkRequestAsUpsert
public void addToCurrentBulkRequestAsUpsert(CommandContext commandContext, String type, com.fasterxml.jackson.databind.node.ObjectNode data, String idFieldName) Description copied from interface:LowLevelIndexingServiceAdds theObjectNodedata as an upsert (i.e. merge if exist, insert if not) to the current bulk request (or creates a bulk request if needed). The bulk request is executed at the end of the transactions, when all items for indexing have been added.- Specified by:
addToCurrentBulkRequestAsUpsertin interfaceLowLevelIndexingService
-
addToCurrentBulkRequestAsFullIndex
public void addToCurrentBulkRequestAsFullIndex(CommandContext commandContext, String type, String id, com.fasterxml.jackson.databind.node.ObjectNode data, String idFieldName) Description copied from interface:LowLevelIndexingServiceAdds theObjectNodedata as a full index (i.e. replace the current indexed document if any exists) to the current bulk request (or creates a bulk request if needed). The bulk request is executed at the end of the transactions, when all items for indexing have been added. The {type, id} parameters are not used during indexing, but is registered internally and can be used to check whether indexing was already triggered via theLowLevelIndexingService.isFullIndexRegisteredOnCurrentBulkRequest(CommandContext, String, String)method. This allows to avoid costly recalculation of data or doing the same indexing operation multiple times in ES. Note that this method doesn't apply that check automatically, and the caller is responsible for calling it.- Specified by:
addToCurrentBulkRequestAsFullIndexin interfaceLowLevelIndexingService
-
addToCurrentBulkRequestAsFullIndexWithExternalVersion
public void addToCurrentBulkRequestAsFullIndexWithExternalVersion(CommandContext commandContext, String type, String id, com.fasterxml.jackson.databind.node.ObjectNode data, String idFieldName, LowLevelIndexingService.BulkIndexRequestConflictHandler bulkIndexRequestConflictHandler) Description copied from interface:LowLevelIndexingServiceEquivalent toLowLevelIndexingService.addToCurrentBulkRequestAsFullIndex(CommandContext, String, String, ObjectNode, String), but using external versioning (vs the one from Elasticsearch).- Specified by:
addToCurrentBulkRequestAsFullIndexWithExternalVersionin interfaceLowLevelIndexingService
-
addToCurrentBulkRequestAsUpsertWithScript
public void addToCurrentBulkRequestAsUpsertWithScript(CommandContext commandContext, com.fasterxml.jackson.databind.node.ObjectNode dataNode, com.fasterxml.jackson.databind.node.ObjectNode scriptNode, String idFieldName) Description copied from interface:LowLevelIndexingServiceAdds theObjectNodedata as an upsert (i.e. merge if exist, insert if not) using an update script to the current bulk request (or creates a bulk request if needed). The bulk request is executed at the end of the transactions, when all items for indexing have been added.- Specified by:
addToCurrentBulkRequestAsUpsertWithScriptin interfaceLowLevelIndexingService
-
isFullIndexRegisteredOnCurrentBulkRequest
public boolean isFullIndexRegisteredOnCurrentBulkRequest(CommandContext commandContext, String type, String id) Description copied from interface:LowLevelIndexingServiceReturns whether a full index was already registered before during the current transaction. Used in conjunction with the {type, id} parameters in theLowLevelIndexingService.addToCurrentBulkRequestAsFullIndex(CommandContext, String, String, ObjectNode, String)method.- Specified by:
isFullIndexRegisteredOnCurrentBulkRequestin interfaceLowLevelIndexingService
-
determineIndex
protected String determineIndex(com.fasterxml.jackson.databind.node.ObjectNode objectNode, IndexedDataObject indexedDataObject) -
determineIndex
-
createHistoryJobEntity
-