Skip to content

ModuleInstall

Aurélien FOUCRET edited this page Feb 2, 2018 · 38 revisions

Magento 2 Module Install

⚠️ This documentation is suitable for ElasticSuite >= 2.5.0. If using an older version please refer to this documentation.

Requirements

  • ElasticSearch 5.x or higher with :

    • Enabled scripting
    • ICU and Phonetic plugin installed
  • Depending the version of ElasticSuite :

ElasticSuite Version Magento required version
ElasticSuite 2.5.x Magento 2.2.x

In order to get a properly set up ElasticSearch server you should read the following page of the wiki ElasticSearch server configuration

Install ElasticSuite through composer :

composer require smile/elasticsuite

Enable the module and run ElasticSuite setup:

Magento is not installed yet :

You can configure ElasticSuite during Magento initial setup by using the following parameters in the setup:install command :

Param Description  Example value
--es-hosts This a comma-separated list of servers in the [host]:[port] format es-node1:9200,es-node2:9200
--es-enable-ssl Use this flag if you want to access to your Elasticsearch server through https. N/A
--es-user The user you want to use to connect ES (can be empty) username
--es-pass The password you want to use to connect ES (can be empty) password

Example : bin/magento setup:install <your params> --es-hosts="elasticsearch:9200" --es-user="username" --es-pass="changeme"

Magento is already installed :

If your Magento instance is already installed, you have to enable the ElasticSuite modules using :

bin/magento module:enable Smile_ElasticsuiteCore Smile_ElasticsuiteCatalog Smile_ElasticsuiteSwatches Smile_ElasticsuiteCatalogRule Smile_ElasticsuiteVirtualCategory Smile_ElasticsuiteThesaurus Smile_ElasticsuiteCatalogOptimizer Smile_ElasticsuiteTracker

Then configure the ElasticSearch server to point to your ElasticSearch cluster (optional if using default server location, http://localhost:9200) and reimport the config :

bin/magento config:set -l smile/smile_elasticsuite_core_base_settings/servers node-1:9200,node-2:9200
bin/magento config:set -l smile/smile_elasticsuite_core_base_settings/enable_https_mode 0
bin/magento config:set -l smile/smile_elasticsuite_core_base_settings/enable_http_auth 0
bin/magento config:set -l smile/smile_elasticsuite_core_base_settings/http_auth_user ""
bin/magento config:set -l smile/smile_elasticsuite_core_base_settings/http_auth_pwd ""
bin/magento app:config:import

Following configuration are available :

Config path Description
smile/smile_elasticsuite_core_base_settings/servers This a comma-separated list of servers in the [host]:[port] format
smile/smile_elasticsuite_core_base_settings/enable_https_mode Enable this parameter if you want to access to your Elasticsearch server through https.
smile/smile_elasticsuite_core_base_settings/enable_http_auth Enable this one if your Elasticsearch server uses basic HTTP authentication
smile/smile_elasticsuite_core_base_settings/http_auth_user If you are using HTTP authentication, set your user auth
smile/smile_elasticsuite_core_base_settings/http_auth_pwd If you are using HTTP authentication, set your user password

Then upgrade your Magento setup using :

bin/magento setup:upgrade 

Configure ElasticSearch server :

You can configure your ElasticSearch server via Stores > Configuration > Smile Elastic Suite > Base Settings

Client configuration

ElasticSearch Client

Parameter Default value Description
ElasticSearch servers list localhost:9200 This a comma-separated list of servers in the [host]:[port] format where you should indicate all your ElasticSearch nodes. E.g. : "es-node1.fqdn:9200, es-node2.fqdn:9200".
Use HTTPS No Enable this parameter if you want to access to your Elasticsearch server through https.
Enable basic HTTP authentication No Enable this one if your Elasticsearch server uses basic HTTP authentication
Basic HTTP authentication user empty If you are using HTTP authentication, set your user auth in this field.
Basic HTTP authentication password empty If you are using HTTP authentication, set your user password in this field.
Enable debug mode No When this parameter is set to "Yes", the module produces logs through the Magento logging system.
Server connection timeout 1 In seconds, the default timeout used when querying the server.

Indices Settings

Indices Settings

Parameter Default value Description
Indices alias name magento2 The default alias put by the module on Magento's related indices.

An alias per store and entity type will be generated with the following format : [indices_alias_name]_[store_code]_[entity_type].

E.g. : magento2_default_catalog_product.
Indices name pattern {{YYYYMMdd}}_{{HHmmss}} The horodated pattern used when creating new index.

An index name per store and entity type, based on the horodated pattern, will be generated with the following format : [indices_alias_name]_[store_code]_[entity_type]_[horodated_pattern].

The E.g. : magento2_default_catalog_product_20160304_094708.
Number of shards per index 1 The number of shards per index. A shard is a single Lucene instance and they are distributed by ElasticSearch amongst all nodes in the cluster.

You can see the Shard definition on the ElasticSearch glossary for more informations.
Number of replicas per index 0 The number of replicas shards per index. Main purposes of replica shards is for failover : if the node holding a primary shard dies, a replica is promoted to the role of primary.

You can read more about Replica Shards on the ElasticSearch documentation.

Configure ElasticSuite as Magento Search Engine :

You can configure Magento to use Smile ElasticSuite as search engine via Stores > Configuration > Catalog > Catalog Search

Parameter Default value Description
Minimal Query Length 1 The minimal search query length to be processed by the engine.
Maximum Query Length 128 The maximum search query length to be processed by the engine.
Search Engine Smile ElasticSuite The default Search Engine used by Magento.

Process first indexing :

Once you have completed all previous points, you can process a full reindexing of the catalogsearch_fulltext index.

bin/magento index:reindex catalogsearch_fulltext
bin/magento index:reindex elasticsuite_categories_fulltext
bin/magento index:reindex elasticsuite_thesaurus

Once the reindex is done, you are all set and can view your frontend catalog and search pages being rendered via Smile Elastic Suite !

Clone this wiki locally