Written by The Jahia Team
 
Developers
   Estimated reading time:

Configuration

Configuration file

Upon installation of the search-provider-elasticsearch module, a configuration file named org.jahia.modules.augmentedsearch.cfg is created under digital-factory-data/karaf/etc/ . This configuration file is used to specify the types of contents that need to be indexed in Elasticsearch.

Please note that whenever you modify this file in a Jahia cluster environment, the synchronization does not happen automatically, so you have to copy the modified file to each cluster node.

Main Resource types

The indexing and the way to return results with Elasticsearch are done differently from the default JCR search provider. The JCR search provider indexes each content individually, then an aggregation is performed when collecting the search results. On the other side, the Eleasticsearch search provider already aggregates in the index contents which are displayable in full page: pages (jnt:page) and contents which come with a content template (e.g. jnt:news). By default, only pages are indexed.

org.jahia.services.search.provider.elasticsearch.content.indexedMainResourceTypes defines the list of content types that can be indexed as full page contents. These content types need to have corresponding content templates in order to be displayed individually, like "pages". Only content templates without restriction (mode / user / permissions), which are set in the studio, can be used to index content.

To index content in your site, you must declare nodes hierarchically. You must always declare jnt:page first and then other nodes in the hierarchy. You declare nodes by adding them under org.jahia.services.search.provider.elasticsearch.content.indexedMainResourceTypes, as shown in following example.

org.jahia.services.search.provider.elasticsearch.content.indexedMainResourceTypes = \   
   jnt:page, \ 
   jnt:news

File changes are reloaded automatically and you do not need to restart Jahia.

Mapped nodetypes

Only fulltext and metadata are indexed by default. If you want to do a search on a specific property you have to list it in:

org.jahia.services.search.provider.elasticsearch.content.mappedNodeTypes

Indexing of contents

By default, only the contents which have the jmix:editorialContent as supertype are indexed as subnodes of main resource (pages or contents with a content template). 

Other content types can be indexed by listing them in:

org.jahia.services.search.provider.elasticsearch.content.indexedSubNodeTypes

Other configurations

  • Language analyzer: defines the analyzer used for a specific language
  • Buffering configuration: this property defines the strategy and timing to use when Jahia checks for the Elasticsearch connection after ES has become unreachable
  • Reindexing requests batch size: you can set the number of requests sent at a time while reindexing

Related links