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

  • 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]
Magento Version ElasticSuite 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]',
            ),
        ),
    ),
)

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'
                ]
            ]

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

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.

Please follow and like us:
error

4 thoughts on “Integration Elasticsearch On Magento 2 Community (CE)

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

  1. After setup:upgrade i get this error:

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

Leave a Reply

Your email address will not be published.

Follow by Email
Facebook
Facebook
LinkedIn