-
Notifications
You must be signed in to change notification settings - Fork 3
Setting up Alfresco with Elasticsearch
Know how to build OpenContent on top of Alfresco.
-
Download Elasticsearch and extract files.
-
Download Kibana and extract files (make sure to download same version as elasticsearch).
-
Navigate to
<elasticsearch_home>/bin
and runelasticsearch.bat
from a command prompt. Once deployed you should be able to see some verification JSON atlocalhost:9200
-
Navigate to
<kibana_home>/bin
and runkibana.bat
from a command prompt. Once deployed you should be able to see Kibana atlocalhost:5601
. Kibana is a dashboard/visualization tool that allows you to view/monitor your Elasticsearch indices.
-
Now that you have elasticsearch and kibana up and running, all you need to do is build OpenContent using the
hpi-demo-alf
project with some slight adjustments. -
Navigate to the
build.gradle
forhpi-demo-alf
and uncomment the:2.elasticsearch
and:3.elasticsearchAlfresco
modules. -
Navigate to the
project-bean-config.xml
forhpi-demo-alf
and uncomment the imports forelasticsearch-bean-config.xml
andalfresco-elasticsearch-bean-config.xml
. -
In the
2.elasticsearch
module, you will findelasticsearch-defaults.properties
. These are the default configurations for an elasticsearch setup. You may have to override some of these in youroverride-placeholders.properties
- Note: OCMS sets document icons in the search results based on the what the mimetype is on the object. Use
elasticsearch.mimeTypeAttrName
to set a property as the mimetype. For example, if documents in your index have atsg:nativeMimetype
property that signifies the mimetype, then set this as the value forelasticsearch.mimeTypeAttrName
- Note: OCMS sets document icons in the search results based on the what the mimetype is on the object. Use
One more thing to take note of is the objectTypeFilter
bean in alfresco-elasticsearch-bean-config.xml
in the 3.elasticsearchAlfresco
module. Due to the invert
property being set, this is a blacklist for objectTypes that we don't want to be indexed. This is useful because other things (user preferences for example, which we don't want to be indexed) trigger our onCreate and onUpdate events that handle our elasticsearch indexing. Adding objectTypes to this list will filter them out. For reference, our event listeners can be found in ExternalIndexEvent.java
After making these changes you should be good to go. Build OpenContent with the hpi-demo-alf
project.
- Make sure
enableIndexing
in theconfig-project.js
that exists in thehpi-demo-alf
project is set to true. This ensures that the configuration of external indexing will be available when you build OCMS.
Once you've got OCMS up and running, in order to get your documents indexing with elasticsearch you will have to do some simple configuration in the OCMS Admin.
- Navigate to the admin page, then click on object types. Navigate to the object type(s) that you would like to be indexed with elasticsearch. Open that object type via the dropdown arrow and select the checkbox next to
Index
. Scroll to the bottom and save the config. Now your object type is all set up for external indexing!
In the less common scenario where you will be querying on multiple object types, the following behavior can be expected when set up for external indexing.
- If all object types in the query are set up for external indexing, then the query will search on those external indices.
- If all object types in the query are NOT set up for external indexing, then the query will fallback to searching via Alfresco.
- If some object types in the query are set up for indexing, and others are not, an error will occur.
OpenContent (OC) © 2016 Technology Services Group