The Elasticsearch connector Live Indexing component listens to messages from ActiveMQ. This means some initial information from Alfresco Repository must be indexed using the Re-indexing component. The Re-indexing component can also be used to index a pre-populated Alfresco Repository.
-
Generate a JSON mapping of namespace to prefix, for your deployed content models.
To help you build the JSON file you can use Alfresco Model Namespace-Prefix Mapping.
-
Copy the JAR deployment file for this module to your local Alfresco Repository deployment, for detailed information on how to deploy a Simple JAR Alfresco Repository see Simple Module (JAR).
-
Once installed, the JSON mapping file can be obtained by using
http://localhost:8080/alfresco/s/model/ns-prefix-map, see the Simplified response:{ "prefixUriMap": { "http://www.alfresco.org/model/custommodelmanagement/1.0": "cmm", "http://www.alfresco.org/model/datalist/1.0": "dl", "http://www.alfresco.org/model/emailserver/1.0": "emailserver", "http://www.alfresco.org/model/action/1.0": "act", "http://www.alfresco.org/model/system/1.0": "sys", "http://www.alfresco.org/model/cmis/1.0/cs01": "cmis", "http://www.alfresco.org/model/bpm/1.0": "bpm", "http://www.alfresco.org/model/dictionary/1.0": "d", "http://www.alfresco.org/model/linksmodel/1.0": "lnk", "http://www.alfresco.org/model/workflow/invite/moderated/1.0": "imwf", "http://www.alfresco.org/model/workflow/invite/nominated/1.0": "inwf", "http://www.alfresco.org/model/content/1.0": "cm", "http://www.alfresco.org/model/content/smartfolder/1.0": "smf", "http://www.alfresco.org/model/cmis/custom": "cmiscustom", "http://www.alfresco.org/model/site/1.0": "st", "http://www.alfresco.org/model/application/1.0": "app", "http://www.alfresco.org/model/imap/1.0": "imap", "http://www.alfresco.org/model/aos/1.0": "aos", "custom.model": "custom", "": "" } } -
Save this content in a new file named
reindex.prefixes-file.json. -
Run the re-indexing application from the command line by passing the already generated JSON file and details for the Database and Elasticsearch servers.
Note
Due to this application providing default values for Alfresco Repository Database username and password, it's strongly recommended you set these credentials using the command line. This ensures database credentials won't be stored in the server filesystem.
java -jar alfresco-elasticsearch-reindexing-3.2.0-app.jar \
--alfresco.reindex.jobName=reindexByIds \
--spring.elasticsearch.rest.uris=http://localhost:9200 \
--spring.datasource.url=jdbc:postgresql://localhost:5432/alfresco \
--spring.datasource.username=alfresco \
--spring.datasource.password=alfresco \
--alfresco.reindex.prefixes-file=file:reindex.prefixes-file.json \
--alfresco.acceptedContentMediaTypesCache.baseurl=http://localhost:8090/transform/config \
--spring.activemq.broker-url=nio://localhost:61616
When completed successfully you will see:
o.s.batch.core.step.AbstractStep : Step: [reindexByIdsStep] executed in 4s952ms
o.a.r.w.ElasticsearchRepoEventItemWriter : Total indexed documents:: 845
o.a.r.listeners.JobLifecycleListener : Current Status: COMPLETED
Once the program has been executed, the existing Alfresco Repository nodes are available in Search Enterprise.
Note
Additional use cases are be covered in the Administer documentation.