Setup and configure Elasticsearch in Litium

Setup Elasticsearch

To setup Elasticsearch you need to download a package from the official site https://www.elastic.co.
Elasticsearch does not have any inbuilt UI, only WebAPI, you can use Kibana to review your data.

Litium also require that the plugin for remote loading of synonym need to be installed. You will find the plugin with installation instructions on https://github.com/bells/elasticsearch-analysis-dynamic-synonym

Configuration

To configure Accelerator to use Elasticsearch you must add the connection string to Elasticsearch into appsettings.json.

"Elasticsearch": {
      "ConnectionString": "http://localhost:9200"
      

 Note: http://localhost:9200 is the default port number that the Elasticsearch listens on.00

To be able to use sniffing mode or password protected Elasticsearch, the username and password must be set in appSettings and not in the connection string.

"Elasticsearch": {
      "Username": "",
      "Password": ""
      

Synonym configuration

Litium is using dynamic synonym to be able to reload them without needing of turning the index offline or manipulating files on all the elasticsearch server nodes. Synonyms will be configured to load the synonyms from remote url and the below appSettings need to be set with the domain name that elasticsearch can use to reach the synonym server. Synonym server is part of shared dependencies and need to be installed before synonyms can be used.

"Elasticsearch": {
      "Synonym": {
        "Server": "http://synonymserver.localtest.me:9210"
      }

If Elasticsearch cannot reach the host the index will not be created. Indexing and searching will then result in errors.

The same Elasticsearch cluster can be used for multiple Litium applications.

To separate Litium applications, the prefix name can be added to Elasticsearch index in appsettings.json.

"Elasticsearch": {
      "Prefix": "prefix_"

The prefix is optional but is recommended to use also for local development to not mix search indexes between installations.

Backoffice

The Elasticsearch node will appear in settings. Now you have to build indices and the search function will work for your site.


Indices default installetion.PNG