Nexcess Logo

How to configure Magento 2 to use Elasticsearch

Knowledge Base Home

Notice anything different?

We've enhanced the appearance of our portal and we're working on updating screenshots. Things might look different, but the functionality remains the same.
September 11, 2019

How to configure Magento 2 to use Elasticsearch, a versatile search engine for large and varied data sets.

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.

    ATTENTION: 
    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. If you are using an Elasticsearch container with multiple sites then you need to pick a unique prefix or it will break the other site every time the cron runs.

  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 Page Cache 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.

    ATTENTION
    : If you are a Nexcess Cloud client,  will use your domain name; for example, mydomain.com/bin/magento.

  3. To reindex the catalog search index only:
    php <your_Magento_install_dir>/bin/magento indexer:reindex catalogsearch_fulltext

  4. 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 your Client Portal.

Jason Dobry
We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.