# Installation & setup
You can install the plugin via the plugin store, or through Composer.
# Craft Plugin Store
To install the plugin, navigate to the Plugin store section of your Craft control panel, search for elasticsearch
and click the Install button.
# Composer
You can also add the package to your project using Composer.
- Open your terminal and go to your Craft project:
cd /path/to/project
- Then tell Composer to add the plugin:
composer require codemonauts/craft-elasticsearch
- Now install and activate the plugin in Craft:
./craft install/plugin elastic
# Setup
After installation, the settings for the plugin needs to be configured. The following settings are available:
Transition:
Activates the transition mode (default after installation). If active, both the internal full-text search in the database and the Elasticsearch index are updated when Craft updates the search index. When searching, only the full-text search in the database is used as a source. This ensures that no changes to elements already included in the Elasticsearch index are lost during the time it takes for all elements to be re-indexed for the Elasticsearch index.
Endpoint
The URL endpoint of the Rest API of the Elasticsearch cluster starting with https://...
Authentication
The authentication method to be used. Here you must choose between Basic Authentication and AWS.
If AWS is selected and the settings for username and password are empty (or the environment variables return an empty string), authentication by instance role is attempted.
Username
The username for Basic Authentication or the IAM access key id when using the AWS authentication method.
Password
The password for Basic Authentication or the IAM secret access key when using the AWS authentication method.
AWS region
When using the AWS OpenSearch service, the region of the domain must be specified.
Index name
The index name to be used. With this name for each site an index alias will be created according to the scheme {{ index name }}_{{ site.handle }}
. The real indexes are then created according to the scheme {{ index name }}_{{ site.handle }}_{{ timestamp }}
.
Field prefix
Prefix for the field names when mapping in Elasticsearch.
Field boosting
Here you can assign a higher boost value to individual fields.