How to combine the potential of Magnolia CMS and Elasticsearch

Published on January 26, 2017 by Guest blogger

Ender Özgür is Head of Software Factories at Neofonie. Neofonie created a new interface between Magnolia and Elasticsearch, a leading enterprise search technology for efficiently scanning large data sets. 

You’ve analyzed the needs, desires and motives of your target group, fought hard for your budget, built the page. Congrats! Now the visitors are coming, but wait, why are they leaving your website so quickly? Of course there are reasons for that; one of them may just be an inadequate search functionality.

Search engines are crucial, particularly within websites with huge and varied data, and also for content management systems such as Magnolia. Site search engines have existed for many years and are common on web or e-commerce sites. But to convert an interested visitor to a happy customer, you need a well-conceived search logic giving a suitably broad range of possibilities and high quality search results.

Search engines within Magnolia

Magnolia currently facilitates two search engines. One is the built-in search where data is indexed from the Java Content Repository (JCR) into an Apache Lucene-based indexer, but this quickly reaches its limits. The second is the Apache Solr Plugin, which is also based on Apache Lucene, but offers a lot more functionalities and possibilities. Beyond Solr, there is also Elasticsearch, a well-known and leading enterprise search engine. Both Apache Solr and Elasticsearch have a common purpose - to deliver the best match for a user query.

Many Neofonie clients look to integrate Magnolia with Elasticsearch. So, a Neofonie developer team became inspired by the solr integration in Magnolia and started a first version of the Elasticsearch integration. Our technical vision was to connect Magnolia author and public instances with one or more Elasticsearch instances to allow indexing of content and assets, and also to use the index for the site search function.


Index and search content in Magnolia with Elasticsearch

Here is a step-by-step deep-dive guide on how we index and search contents in Magnolia with Elasticsearch. As an example, we will use and add tours from the Magnolia Travel Demo that most of you know.

  1. Open the Configuration App and add a new index to /modules/neofonie-module-elasticsearch/config/indexJob


  1. You could copy the sample pages index job and adapt settings. Select your workspace and docType of the documents.

2.1 In targets, we can define several index servers. By default, there's localhost:9200 (copied from pages).

           2.2 In exclude, we can prevent fields, areas or components from being sent to the index.


  1. Configure field mappings: this information is used to create the mapping schema in Elasticsearch. If you simply add the field name, it's automatically indexed as a string with the same name at Elasticsearch. You can add these options:

            3.1 Type: the desired data type of this field.

3.2 Magnolia Type: if it's a special type, uuid is currently supported. It is meant to be used with Magnolia uuids. If there are multiple uuids, they will be sent as array to Elasticsearch, not as joined string (the default behaviour).

           3.3 Elasticsearch Name: field name in Elasticsearch.

3.4 Every other field used as mapping parameters in Elasticsearch, i.e. index with value not_analyzed or include_in_all with value false. For details see


  1. Adding the cron option will update index every time; in this example, it is every 10 minutes. Syntax is nearly the same as in linux cron, but you can also specify seconds here.

  2. Add a new page from template Elasticsearch Results.

5.1 Configure your workspace.

5.2. Assign Elasticsearch fields to template.


  1. Add a category facet.


  1. Enjoy searching your contents.

Fig. Demo search page


Fig. Demo search results page


The Neofonie ElasticSearch module is available on Magnolia marketplace.


About the author


Ender Özgür studied informatics at the Technical University of Berlin. As Head of Software Factories at Neofonie, he is responsible for modern implementations of development projects. Neofonie develops individual, digital solutions and provides consulting, conception, design, development and operations under one umbrella. Its clients include Wort & Bild Verlag, Audi, Leica, Rausch and Super RTL.



{{item.userId}}   {{item.timestamp | timestampToDate}}

About the author Guest blogger

Magnolia has an amazing community of partners and clients, among them quite a few wordsmiths. From time to time, they put their expertise into blog posts and share them on this platform.

See all posts on Guest blogger

Demo site Contact us Free trial