DC 5.6 Elastic Search on-premise

To install Elastic search on-premise, do the following

This documentation is written for Elastic search version 8.1.2

Download the latest version of Elastic as a zip

Download the latest version of Elastic search from their website

https://www.elastic.co/downloads/elasticsearch

Install Elastic search as a service on windows

To install Elastic search as a windows service follow Elastic search documentation

The service is going to run from the folder you run the command from. Thus you should properly move it into a dedicated “services” folder like the one you creates from the DC PowerShell script.

https://www.elastic.co/guide/en/elasticsearch/reference/8.1/zip-windows.html#windows-service

Set a RAM limit on Elastic search

This MUST be done before starting Elastic search service as otherwise it will consume all available RAM on the server!

Open a commandline in the bin directory in which the service is installed and type the following command

elasticsearch-service.bat manager

This opens op the following dialog

Go to the Java tab and limit the initial memory pool and maximum memory pool settings. This setting should be increased with the amount of assets and metadata on the system to index.

Edit and Start the service

Per default the Service does not automatically start. This must be edited from the Services Windows UI.

Once this has been edited, start the installed service

Alternatively running the following command also starts the service

elasticsearch-service.bat start

 

Reset the password for the elastic user

Elastic search is password protected and this must be reset in order to authenticate against the service. This can be achieved from the commandline tools.

Open a commandline in the bin directory of the elastic service and type the following command

elasticsearch-reset-password -u elastic

Once the operation has been completed, the password of the user is shown in the commandline

Validate that Elastic is running

Open a browser and type in the below url

The should prompt you with a login dialog in which you type elastic as username and the password from the step above.

If Elastic is installed and runs correctly, you should see something like this

Generate an API key in Postman

In order to actually use Elastic, you must generate an API key. This is done using their API.

This can be done using the following documentation

https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html

Using Postman this can be done using the following steps

  1. Make a new POST request with the following url http://localhost:9200/_security/api_key

  2. In the Authorization Params tab, chose Basic Auth in the Type dropdown.

  3. Put in the Elastic username and password used the previous steps

  4. In the Body Params tab, chose Rawi in the selection and JSON in the dropdown

  5. Put in the following body

     

  6. Execute the request

This should give you the following response

The API key to use is the encoded key in the response

 

Generate an API key in Powershell

 

Insert the API key in the appsettings.json

In the Appsettings file of the LegacyService (Webs/DigizuiteCore/LegacyService/appsettings.json)

Insert the API key from the above step in the section for Elastic search