In my last two blogs we have discussed how to create components by consuming the data from Elasticsearch and then how to index data in Elasticsearch when publishing components.
Today,We are going to discuss and create Elasticsearch module in DXA which will have following features .DXA Modules allows us to extend its Functionality via creating new modules. Here we can create new modules which gives us flexibility & re-usability.
Features and Advantages :-
- Free text search .
- Tag based filtering.
- Lighting fast response powered by Elasticsearch.
- Pagination and sorting based on fields.
- Article detail page.
In order to use the Elasticsearch module we need to setup the storage extension and Elasticsearch which we already discussed in my previous blog here.
Once that is done using Elasticsearch module in DXA we can search the content from Elasticsearch and render on DXA based application .
Let's discuss the CMS part first.
|Elasticsearch Module structure|
- Define module's folder structure
- DXA gives us predefined structure where we can keep all the building blocks of the module.
- For each new DXA module, we need to create a new folder in Modules Folder
- The name of folder is usually module name.
Next is creating the Schema and Component Templates. I have create dynamic components and index them in Elasticsearch and render on the DXA based web application.
.Happy Coding and Keep Sharing !!!
- Publish all the dynamic components and index them in Elastic.
- Create new area in you DXA web Application.
- We can call Elastic RESTFul API to get the data.
- Data will be returned in the form of JSON.
- Create model to deserialize the JSON.
- Let's search for the text SDL.
- Result can be further filtered based on tagging as well.
- Compare the search result with the data index in Elastic
Elastic Search RESTFul API