ÃÛ¶¹ÊÓÆµ

Can’t change Search Engine using Commerce Admin (Search Engine menu is inaccessible)

Warning: MySQL catalog search engine will be removed in ÃÛ¶¹ÊÓÆµ Commerce 2.4.0. You must have Elasticsearch host setup and configured prior to installing version 2.4.0.
Refer to:
Install and configure Elasticsearch
Install and configure Opensearch
Install and configure Live Search

This article provides a solution for changing the ÃÛ¶¹ÊÓÆµ Commerce Search Engine using the Commerce Admin if the Search Engine field isn’t displayed or the Use system value checkbox is grayed-out and not accessible.

Description description

Environment

  • ÃÛ¶¹ÊÓÆµ Commerce on-premises: 2.4.X

  • ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure:

    • Version: 2.4.X
    • Starter and Pro plan architecture
  • MySQL, Elasticsearch, Opensearch, Live Search: all supported versions

Change Search Engine using the Admin (steps)

  1. Log in to the Admin as an Administrator.

  2. On the left-side of the Admin sidebar, click on Stores.

  3. Under Settings, choose Configuration.

  4. Navigate to the panel on the left under Catalog, and choose Catalog.

  5. Expand the Catalog Search section.

    catalog_menu.png

  6. Go to the Search Engine field and remove selection from the Use system value checkbox.

  7. Click the Search Engine menu and select one of the available options as shown below.

    search_engine_menu.png

  8. Click on Save Config in the top-right hand corner of the page.

Issues with ÃÛ¶¹ÊÓÆµ Commerce on-premises

Issue 1: Search Engine field is not displayed

When you access the Catalog Search section, the Search Engine menu isn’t displayed at all.

search_engine_not_displayed.png

Cause: Store View is not Default Config

The Store View for the Admin has been set to any value other than Default Config.

The search engine is a global configuration set on the application level, not on the Store Scope. Stores within an ÃÛ¶¹ÊÓÆµ Commerce application can’t use different search engines.

Issue 2: Can’t uncheck “Use system valueâ€

When you access the Catalog Search section of the Admin, the Use system value checkbox is grayed-out, so you can’t remove selection from the checkbox to later change the search engine.

Cause

The default search engine has been configured on the application configuration level in the app/etc/env.php or app/etc/config.php files and thus can’t be changed using the Admin.

Example of the section with default search engine configuration:

'system'=>
array (
'default'=>
array (
'catalog'=>
array (
'search'=>
array (
'engine'=>'mysql',
),
),
),
),

Resolution resolution

Issue 1: Search Engine field is not displayed

Solution: Set Store View to Default Config

  1. Log in to the Admin as an Administrator.

  2. On the left-side of the Admin sidebar, click on Stores.

  3. Navigate to Settings and choose Configuration.

  4. In the upper-left hand corner, click the Store View selector and choose Default Config.

  5. Click on OK in the confirmation dialog box to approve the store view changes.

    change_store_view.png

Related documentation: Changing Scope in our user guide.

Issue 2: Can’t uncheck “Use system valueâ€

Solution

Remove the section with default search engine configuration from the app/etc/env.php or the app/etc/config.php configuration files.

ÃÛ¶¹ÊÓÆµ Commerce configuration files in ÃÛ¶¹ÊÓÆµ Commerce Configuration Guide

ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure

Switching search engines using the Admin isn’t available in ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure, due to the way the cloud infrastructure has been organized.

During the deployment process, the ÃÛ¶¹ÊÓÆµ Commerce on cloud infrastructure deployment scripts check if Elasticsearch has been declared in the MAGENTO_CLOUD_RELATIONSHIPS variable. If declared, Elasticsearch is selected as the active search engine and configured automatically; the MySQL search engine becomes inaccessible in the Admin. If the Elasticsearch relationship hasn’t been declared, MySQL is set to active, and Elasticsearch becomes inaccessible.

It is not recommended to edit the app/etc/env.php or the app/etc/config.php configuration files directly on your cloud environment; that’s why changing these files to make the Elasticsearch engine to be displayed in the Admin (the solution we recommend in the previous section) isn’t applicable for your cloud project.

Change search engine on Staging and Production environments

Before switching search engine from MySQL to Elasticsearch on your Staging and Production environments, make sure you have previously submitted a support ticket requesting to enable Elasticsearch on the environment and the ticket has been resolved successfully.

To change the search engine used on your Staging and Production environments, change the SEARCH_CONFIGURATION environment variable in your .magento.env.yaml file on your local environment, then push changes to the Integration and Staging/Production environments for the changes to take effect.

If you’re switching to Elasticsearch 7, the SEARCH_CONFIGURATION variable in the resulting .magento.env.yaml file might look as follows:

stage:
  deploy:
   SEARCH_CONFIGURATION:
     engine: elasticsearch7
     elasticsearch_server_hostname: hostname
     elasticsearch_server_port: '12345'
     elasticsearch_index_prefix: magento
     elasticsearch_server_timeout: '15'

If you’re switching to Opensearch (in 2.4.6 and later,) the SEARCH_CONFIGURATION variable in the resulting .magento.env.yaml file might look as follows:

stage:
  deploy:
   SEARCH_CONFIGURATION:
     engine: opensearch
     elasticsearch_server_hostname: hostname
     elasticsearch_server_port: '12345'
     elasticsearch_index_prefix: magento
     elasticsearch_server_timeout: '15'

If you’re switching to Live Search, the SEARCH_CONFIGURATION variable in the resulting .magento.env.yaml file might look as follows:

stage:
  deploy:
   SEARCH_CONFIGURATION:
     engine: livesearch
Support Knowledge Base
Developer Documentation
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f