Cannot change Search Engine using Commerce Admin (Search Engine menu is inaccessible)
This article provides a solution for changing the Adobe Commerce Search Engine using the Commerce Admin if the Search Engine field is not displayed or the Use system value checkbox is greyed out and not accessible.
In this article:
Affected versions
-
Adobe Commerce on-premises: 2.4.X
-
Adobe 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)
- Log in to the Admin as an Administrator.
- On the left-side of the Admin sidebar, click on Stores.
- Under Settings, choose Configuration.
- Navigate to the panel on the left under Catalog, and choose Catalog.
- Expand the Catalog Search section.
- Go to the Search Engine field and remove selection from the Use system value checkbox.
- Click the Search Engine menu and select one of the available options as shown below.
- Click on Save Config in the top-right hand corner of the page.
Issues with Adobe Commerce on-premises
Issue 1: Search Engine field is not displayed
When you access the Catalog Search section, the Search Engine menu is not displayed at all.
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 Adobe Commerce application cannot use different search engines.
Solution: Set Store View to Default Config
- Log in to the Admin as an Administrator.
- On the left-side of the Admin sidebar, click on Stores.
- Navigate to Settings and choose Configuration.
- In the upper-left hand corner, click the Store View selector and choose Default Config.
- Click on OK in the confirmation dialog box to approve the store view changes.
Related documentation: Changing Scope in our user guide.
Issue 2: Cannot uncheck “Use system value”
When you access the Catalog Search section of the Admin, the Use system value checkbox is greyed out so you cannot 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 cannot be changed using the Admin.
Example of the section with default search engine configuration:
'system'=>
array (
'default'=>
array (
'catalog'=>
array (
'search'=>
array (
'engine'=>'mysql',
),
),
),
),
Solution
Remove the section with default search engine configuration from the app/etc/env.php
or the app/etc/config.php
configuration files.
Related articles in our developer documentation
Adobe Commerce configuration files in Adobe Commerce Configuration Guide
Adobe Commerce on cloud infrastructure
Switching search engines using the Admin is not available in Adobe Commerce on cloud infrastructure due to the way the cloud infrastructure has been organized.
During the deployment process, the Adobe 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 has not 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 is why changing these files to make the Elasticsearch engine to be displayed in the Admin (the solution we recommend in the previous section) is not 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 are 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 are 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 are 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
Related documentation
Support Knowledge Base
Developer Documentation
- Set up Elasticsearch service
- Build and deploy (documentation about the
.magento.env.yaml
configuration file) - Deploy variables (SEARCH_CONFIGURATION section)
- Services (documentation about the
.magento/services.yaml
configuration file) - Live Search