Integration Elasticsearch On Magento 2 Community (CE)

Integration Elasticsearch On Magento 2 Community (CE)

Magento 2 Open Source (CE) does not provide integration with Elasticsearch by default, but we have other choices for this case there are

  • Elasticsearch is built-in – Magento 2.3.4
  • Magento 2 Free Module: Elasticsuite from Smile-SA => https://github.com/Smile-SA/elasticsuite/
  • Elasticsearch Free Service cloud: https://bonsai.io

Now let we are going to Install Elasticsearch extension and config Elasticsearch extension with Bonsai Elasticsearch cloud

Step 1: Create an account in https://bonsai.io and create your first Cluster.

After all you will have an Access URL like this: https://[username]:[password]@[application-code].ap-southeast-2.bonsaisearch.net

bonsai dashboard

Step 2: Let login to the web server with ssh command line: (I will provide install module using Composer)

– Using composer require Elasticsearch Module:

composer require smile/elasticsuite ~[version number]
Code language: JavaScript (javascript)
Magento VersionElasticSuite Latest Version
Magento 2.0.x Opensource (CE) / Commerce (EE)ElasticSuite 2.1.x latest release : composer require smile/elasticsuite ~2.1.0
Magento 2.1.x Opensource (CE) / Commerce (EE)ElasticSuite 2.3.x latest release : composer require smile/elasticsuite ~2.3.0
Magento 2.2.x Opensource (CE) / Commerce (EE)ElasticSuite 2.6.x latest release : composer require smile/elasticsuite ~2.6.0
Magento 2.3.x Opensource (CE) / Commerce (EE)ElasticSuite 2.7.x latest release : composer require smile/elasticsuite ^2.7.0

Step 3: Config your Elasticsearch module.

  • After composer downloaded and installed Elasticsearch module, Install and run it on to your Magento 2 Website, you need to be config Elasticsearch Server Access Connection.  Let use access URL you have created at Step 1.

Edit and add the block of code below to your env.php file

'system' => array( 'default' => array( 'smile_elasticsuite_core_base_settings' => array( 'es_client' => array( 'servers' => '[application-code].ap-southeast-2.bonsaisearch.net:443', 'enable_https_mode' => 1, 'enable_http_auth' => 1, 'scheme' => 'https', 'http_auth_user' => '[username]', 'http_auth_pwd' => '[password]', ), ), ), )
Code language: PHP (php)

Other config:

'smile_elasticsuite_core_base_settings' => [ 'es_client' => [ 'servers' => '127.0.0.1:9200', 'enable_https_mode' => 0, 'enable_http_auth' => 0, 'http_auth_user' => '', 'http_auth_pwd' => '', 'scheme' => 'http' ] ]
Code language: PHP (php)

Step 4: Run command line enables the module and installs the upgrade.

Enable Module: 

bin/magento module:enable \ Smile_ElasticsuiteCore \ Smile_ElasticsuiteCatalog \ Smile_ElasticsuiteSwatches \ Smile_ElasticsuiteCatalogRule \ Smile_ElasticsuiteVirtualCategory \ Smile_ElasticsuiteThesaurus \ Smile_ElasticsuiteCatalogOptimizer \ Smile_ElasticsuiteTracker
Code language: JavaScript (javascript)

Setup Upgrade

bin/magento setup:upgrade

Process first indexing

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

Let check the result: Bonsai dashboard.

Thanks for reading.

    • 7 years ago

    After setup:upgrade i get this error:

    No alive nodes found in your cluster, any ideas?
    My env.php is as you described it.

    • 7 years ago

    Is there perhaps a tutorial with Elasticsearch Cloud instead of bonsai somewhere?

      • 7 years ago

      as Other Config, when you have got configuration from Elasticsearch Cloud then edit the sample configuration set Magento connect to Elaticsearch Cloud (Magento CE)

    • 6 years ago

    Thank you, this was helpful!

    • 6 years ago

    Hey! Do I suppose to ask my provider to install the elasticsearch on my hosting stack because I have seen in one of the blog: https://www.cloudways.com/blog/configuring-elasticsearch-magento/ which was like this?

      • 6 years ago

      Hi Luis Paul

      Yes, you can. you can install ES by yourself, you can control anything.

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Rating