Install Elasticsearch¶
Download and install Elasticsearch¶
Install Elasticsearch on your server. As an example, use the following Docker command:
1 |
|
Note
Ibexa DXP supports Elasticsearch in version 7.16.2 or higher.
Verify the instance¶
To make sure that the Elasticsearch instance operates properly, access the instance (for example, with curl http://localhost:9200/
).
If Elasticsearch operates properly, an object with cluster details is displayed. It should be similar to the following example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Set the default search engine¶
Set the following environment variable (for example, in the .env
or .env.local
file):
1 |
|
Configure the search engine¶
Ibexa DXP comes pre-configured to work with an Elasticsearch cluster that uses default settings, and you can use this initial setup for testing purposes.
However, to effectively search through actual data, you must provide specific settings.
All configuration is made in the /config/packages/ibexa_elasticsearch.yaml
file.
Note
All the settings, their order and meaning, correspond to the settings that are described in the Elasticsearch documentation.
First, decide how Ibexa DXP connects to Elasticsearch and configure other connection settings. For more information, see Configuring connections.
Then, define a Field Type mappings template that instructs Elasticsearch to interpret Ibexa DXP fields as specific types. For more information, see Configuring Field Type mappings.
Push the templates¶
For each of your defined connections, push the templates to the Elasticsearch engine by running the following command:
1 |
|
You can modify the behavior of the command with a number of switches. Use the -h
switch to display a complete list of available options.
Reindex the database¶
After creating index templates, run the following command to reindex your data:
1 |
|
Risks of premature indexing
Do not reindex your data before you create index templates. Otherwise Elasticsearch attempts to use its dynamic field mapping feature to create type mappings automatically.