How to configure Magento 2 to use Elasticsearch

How to configure Magento 2 to use Elasticsearch


What you need

If you are a Nexcess Magento 2 Cloud client:

Step 1: Configure Magento 2 to use Elasticsearch

ATTENTION: If you have not already done so, follow the steps provided in How to enable Elasticsearch for your Nexcess Cloud account before continuing. 

  1. Log in to your Magento 2 admin panel.

  2. From your dashboard, select Stores > Configuration.

  3. From the Catalog drop-down menu, select Catalog, then Catalog Search.

  4. From the Search Engine drop-down list, select Elasticsearch 6.0+ (1). Fill the Elasticsearch Server Hostname (2) and Elasticsearch Server Port (3) fields.

    If you are a Magento 2 Nexcess Cloud client, use the information provided in Step 4 of How to enable Elasticsearch for your Magento 2 Cloud account for the Elasticsearch Server Hostname and Elasticsearch Server Port fields.

  5. Click Test Connection. If the test passes, go to Step 2 be;pw. If it fails, either follow the provided recommendations, or contact our 24/7 Support team by email or through your Client Portal.


Step 2: Refresh your full page cache

You may perform this step from either the Admin panel or the command line.

Method 2a: From the Admin Panel

  1. From the dashboard, select System > Cache Management.

  2. Select the PageCache check box (1), confirm the Refresh selection (2), then click Submit.

Method 2b: From the command line

If necessary, see How to generate and view SSH/FTP passwords for your Nexcess Cloud Account.

Log in to your Magento server, then issue:

magento cache: clean

Step 3: Reindex catalog search

  1. Log in to your Magento server.

  2. Enter one of the following commands, but replace the angled brackets (<>) and everything between them with the indicated information.

    : If you are a Nexcess Cloud client, <your_magento_install_dir> will use your domain name; for example,

    1. To reindex the catalog search index only:

      php <your_Magento_install_dir>/bin/magento indexer:reindex catalogsearch_fulltext

    2. To reindex all indexers:

      php <your_Magento_install_dir>/bin/magento indexer:reindex

Reverting to MySQL

If you experience issues with Elasticsearch and cannot resolve them, repeat Steps 1A-1D, but select MySQL for the Search Engine field and save. Then, repeat Step 2: Refresh your full page cache and Step 3: Reindex catalog search.

For 24-hour assistance any day of the year, contact our Support Team by email or through the Client Portal.

Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.