Install Magento 2 Smile ElasticSuite on Ubuntu

22nd December 2018 posted in Magento, Ubuntu

The Smile ElasticSuite is an excellent free set of modules which enhance Magento 2

The official developers’ github page is here

Included in the suite are

  • Visual Merchandiser for adding sort order to products in category pages
  • Allow for multiple filters to be selected in the layered nav area
  • Add a slider selector for price filter
  • Add search autocomplete
  • Search drop down shows product images and categories after autocomplete

Here is a list of instructions to run on the server to install the suite on an existing Magento 2 store. We assume you don’t already have ElasticSearch installed (skip steps 1 and 2 if you do).

1. Install Java Runtime Environment

First, you will need a Java Runtime Environment (JRE) because ElasticSearch is written in the Java programming language.

sudo apt-get install openjdk-8-jre

2. Install ElasticSearch

Download and install the Public Signing Key:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

Download the compatible version for Elasticsuite :

cd /home
sudo mkdir elastic
cd elastic
sudo apt-get install apt-transport-https
sudo wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.16.deb
sudo sha1sum elasticsearch-5.6.16.deb
sudo dpkg -i elasticsearch-5.6.16.deb

Now you can try to start the ElasticSearch instance

sudo service elasticsearch start

You can then test that your ES instance is started by checking the response of the following command :

curl localhost:9200
This should produce something like the following output :
"name" : "GqiI8dz",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "uosgC6uvQWeipo3c9sNEEg",
"version" : {
"number" : "5.6.0",
"build_hash" : "781a835",
"build_date" : "2017-09-07T03:09:58.087Z",
"build_snapshot" : false,
"lucene_version" : "6.6.0"
},
"tagline" : "You Know, for Search"
}

3. Installing required plugins.

You have now to install some plugins that are required by Smile Elastic Suite.

Plugins can be installed with the bin/elasticsearch-plugin tool of Elastic Search.

You have to go to your Elastic Search installation directory.

Locate your “Home” directory ( Look for Settings -> Path -> Home in the following command output for value ).

curl "localhost:9200/_nodes/settings?pretty=true"

 

"settings" : {
"pidfile" : "/var/run/elasticsearch/elasticsearch.pid",
"cluster" : {
"name" : "elasticsearch"
},
"path" : {
"conf" : "/etc/elasticsearch",
"data" : "/var/lib/elasticsearch",
"logs" : "/var/log/elasticsearch",
"home" : "/usr/share/elasticsearch"
},

Go to the “Home” directory :

cd /usr/share/elasticsearch

Install plugins :

sudo bin/elasticsearch-plugin install analysis-phonetic
sudo bin/elasticsearch-plugin install analysis-icu

Restart ElasticSearch node in order to apply change :

sudo service elasticsearch restart

Note : If you are using an ElasticSearch cluster with several nodes you have to install the plugins on each nodes.

4. Install the ElasticSuite

First find out which version of the suite you need, by matching the release version to the version of Magento 2 you have from this page

For this tutorial we will install the latest version with this command

composer require smile/elasticsuite ^2.8.0

5. Find/Create application access keys at Magento

You will need access keys from Magento.

If the composer command asks you for the keys, enter the public key for the username and the private key for the password.

6. Clear Magento Cache

Now you need to clear the Magento cache, make sure you are in the Magento application web root

sudo php bin/magento cache:clean
sudo php bin/magento cache:flush

Install the ElasticSuite modules

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

Now make Magento perform an upgrade and compile the new classes

sudo php bin/magento setup:upgrade
sudo php bin/magento setup:di:compile
sudo php bin/magento indexer:reindex

Finally set the folder permissions to allow the static content and admin files to be re-generated

sudo chmod -R 777 var && sudo chmod -R 777 pub && sudo chmod -R 777 generated

Tags: Magento 2