Following my previous post on controlling indexing behavior, I tested the indexing behavior with Alfresco Content Services 7.2.1.3 enterprise and Search Enterprise 3.1.1.
- You have an environment up and running with Alfresco Content Services 7.x and Search Enterprise 3.x)
- You have administrative privileges
Control indexing behavior with help of content model aspect:
<aspect name="cm:indexControl"> <title>Index Control</title> <properties> <property name="cm:isIndexed"> <title>Is indexed</title> <type>d:boolean</type> <default>true</default> </property> <property name="cm:isContentIndexed"> <title>Is content indexed</title> <type>d:boolean</type> <default>true</default> </property> </properties> </aspect>
- If you use folder rule to apply the cm:indexControl aspect
- Or If you use any script to update the node to apply the cm:indexControl aspect with cm:isContentIndexed to false
- By creating a behavior using "org.alfresco.repo.node.NodeServicePolicies" policy and implement "onCreateNode" method and set the cm:indexControl aspect. Learn more here on implementing Behavior Policies.
- Create a custom aspect by overriding the default values as stated above
- Create a custom aspect overriding cm:indexControl.
- For example, if you want to disable content indexing, set the cm:isContentIndexed to false. To learn more on content model, aspects and their application, refer: Content Model Extension Point
<aspect name="demo:customIndexControl"> <title>Override Index Control to disable content indexing by default</title>
<parent>cm:indexControl</parent> <overrides> <property name="cm:isIndexed">
<default>true</default></property> <property name="cm:isContentIndexed"> <default>false</default> </property> </overrides> </aspect>
Control indexing behavior via LiveIndexingApp mediation-filter :
Live Indexing App is a component within Elastic Search connector which is responsible for indexing nodes (content/metadata). There is a component called Mediation (alfresco-elasticsearch-live-indexing-mediation) which subscribes to the alfresco.event.topic (activemq:topic:alfresco.repo.event2) and processes the incoming node events. The configuration of this component allows you to declare four blacklist sets for filtering out nodes or attributes to be indexed. These blacklists can be specified in the file using the alfresco.mediation.filter-file property. The default file is called mediation-filter.yml that must be in the module classpath.
You need to keep in mind that, if you needed to exclude only specific nodes then this option is not a right choice. This approach controls the indexing behavior globally. It can either enable or disable globally at a time.
mediation: nodeTypes: contentNodeTypes: nodeAspects: - sys:hidden fields: - cmis:changeToken - alfcmis:nodeRef - cmis:isImmutable - cmis:isLatestVersion - cmis:isMajorVersion - cmis:isLatestMajorVersion - cmis:isVersionSeriesCheckedOut - cmis:versionSeriesCheckedOutBy - cmis:versionSeriesCheckedOutId - cmis:checkinComment - cmis:contentStreamId - cmis:isPrivateWorkingCopy - cmis:allowedChildObjectTypeIds - cmis:sourceId - cmis:targetId - cmis:policyText - trx:password - pub:publishingEventPayload
mediation: nodeTypes: contentNodeTypes: - cm:content fields: - cmis:changeToken - alfcmis:nodeRef - cmis:isImmutable - cmis:isLatestVersion - cmis:isMajorVersion - cmis:isLatestMajorVersion - cmis:isVersionSeriesCheckedOut - cmis:versionSeriesCheckedOutBy - cmis:versionSeriesCheckedOutId - cmis:checkinComment - cmis:contentStreamId - cmis:isPrivateWorkingCopy - cmis:allowedChildObjectTypeIds - cmis:sourceId - cmis:targetId - cmis:policyText - trx:password - pub:publishingEventPayload
mediation: nodeTypes: contentNodeTypes: nodeAspects: - sys:hidden fields: - cmis:changeToken - alfcmis:nodeRef - cmis:isImmutable - cmis:isLatestVersion - cmis:isMajorVersion - cmis:isLatestMajorVersion - cmis:isVersionSeriesCheckedOut - cmis:versionSeriesCheckedOutBy - cmis:versionSeriesCheckedOutId - cmis:checkinComment - cmis:contentStreamId - cmis:isPrivateWorkingCopy - cmis:allowedChildObjectTypeIds - cmis:sourceId - cmis:targetId - cmis:policyText - trx:password - pub:publishingEventPayload
- demo:documentIDInternal
- demo:publisherInternal
mediation: nodeTypes: - demo:invoice contentNodeTypes: nodeAspects: - sys:hidden fields: - cmis:changeToken - alfcmis:nodeRef - cmis:isImmutable - cmis:isLatestVersion - cmis:isMajorVersion - cmis:isLatestMajorVersion - cmis:isVersionSeriesCheckedOut - cmis:versionSeriesCheckedOutBy - cmis:versionSeriesCheckedOutId - cmis:checkinComment - cmis:contentStreamId - cmis:isPrivateWorkingCopy - cmis:allowedChildObjectTypeIds - cmis:sourceId - cmis:targetId - cmis:policyText - trx:password - pub:publishingEventPayload
Following property needs to be set to control indexing behavior via mediation-filter:
alfresco.mediation.filter-file or ALFRESCO_MEDIATION_FILTER-FILE => The configuration file which contains fields and node types blacklists. The default value is classpath:mediation-filter.yml
Mediation filter can be provided via either of the following:
- When using docker based environment, you can create a bind mount and provide your custom mediation-filter.yml
- If you are using separate services for each component
live-indexing-mediation: image: quay.io/alfresco/alfresco-elasticsearch-live-indexing-mediation:3.1.1 depends_on: - elasticsearch - alfresco environment: SPRING_ELASTICSEARCH_REST_URIS: http://elasticsearch:9200 SPRING_ACTIVEMQ_BROKERURL: nio://activemq:61616 ALFRESCO_MEDIATION_FILTER-FILE: file:/usr/tmp/mediation-filter.yml volumes: - ./mediation-filter.yml:/usr/tmp/mediation-filter.yml
- If you are using AIO live indexing service (alfresco-elasticsearch-live-indexing)
live-indexing:
image: quay.io/alfresco/alfresco-elasticsearch-live-indexing:3.1.1
depends_on:
- elasticsearch
- alfresco
environment:
SPRING_ELASTICSEARCH_REST_URIS: http://elasticsearch:9200
SPRING_ACTIVEMQ_BROKERURL: nio://activemq:61616
ALFRESCO_MEDIATION_FILTER-FILE: file:/usr/tmp/mediation-filter.yml
ALFRESCO_ACCEPTED_CONTENT_MEDIA_TYPES_CACHE_BASE_URL: http://transform-core-aio:8090/transform/config
ALFRESCO_SHAREDFILESTORE_BASEURL: http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file/
volumes:
- ./mediation-filter.yml:/usr/tmp/mediation-filter.yml
Bind mount syntax -> [SOURCE:]TARGET[:MODE]
- SOURCE can be a named volume or a (relative or absolute) path on the host system.
- TARGET is an absolute path in the container where the volume is mounted.
- MODE is a mount option which can be read-only (ro) or read-write (rw) (default).
For more details read docker volumes documentation here.
- Launch the containers again, use following command. This would launch the containers with updated changes:
docker-compose -f ./docker-compose.yml up
- If you have installation based on distribution package then pass the following param to live indexing boot app and start it:
java -jar C:\alfresco-elastic-search-services\alfresco-elasticsearch-live-indexing-3.1.1-app.jar ^
--alfresco.mediation.filter-file=file:C:\\alfresco-elastic-search-services\\mediation-filter.yml
OR
java -jar C:\alfresco-elastic-search-services\alfresco-elasticsearch-live-indexing-3.1.1-app.jar ^
-DALFRESCO_MEDIATION_FILTER-FILE=file:C:\\alfresco-elastic-search-services\\mediation-filter.yml
Note: Any newly created/uploaded content will be taken care by the live indexing app. For existing content, a re-indexing will be required.
More on Elastic Search connector can be found here.
Thank you for sharing the tutorial.
ReplyDelete