Setup and configure Elasticsearch

This article explains how setup and configure ES in Litium

Setup Elasticsearch

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

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 ES you need to add the connection string to ES into web.config.

<connectionStrings>
   <add name="ElasticsearchConnectionString" connectionString="http://localhost:9200" />

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

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

<appSettings>
    <add key="Litium:Elasticsearch:Username" value="" />
    <add key="Litium:Elasticsearch:Password" value="" />

Add a settings for connection pool type, if the settings is missing Litium use the static version. Change connection pool type in appSettings where value will be SingleNode, Sniffing, Static, Sticky and StickySniffing.

<appSettings>
    <add key="Litium:Elasticsearch:ConnectionPoolType" value="sniffing" />

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 in web.config need to be set with the domain name that elasticsearch can use to reach your installation.

<appSettings>
    <add key="Litium:Elasticsearch:Synonym:Host" value="http://domainname" />

If elasticsearch can not 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 ES index in web.config.

<appSettings>
    <add key="Litium:Elasticsearch:Prefix" value="customer1" />

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 need to build indices and search will work for your site.


Indices default installetion.PNG