Showing results for 
Search instead for 
Did you mean: 

Elasticsearch is the default catalog search engine in Magento 2.4.0

Senior Member

In Magento 2.4.0, we will be removing support for three deprecated catalog search engines: MySQL and Elasticsearch 2.x, 5.x, and 6.x. Merchants must install and configure a supported version of Elasticsearch before they upgrade to Magento 2.4. New installations require a connection to Elasticsearch to complete.


Extension developers must update any module that depends on the unsupported search engines. 


IMPORTANT: Prior to upgrading, check your search configuration to ensure you are using a supported search engine for the target version and that it is properly configured. If configuration changes are required, you must make them prior to upgrading. 



Supported search engines in Magento 2.4 

  • Elasticsearch 7.6.x


Upgrading to 2.4.0 


You must configure Magento to use a supported search engine prior to upgrading to 2.4.0. During the upgrade process, Magento validates the search engine configuration. It will not proceed if you are using an unsupported search engine or if it cannot connect to an Elasticsearch server. 

If MySQL is your search engine in Magento 2.3, use the following resources to help guide you through this process: 



If Elasticsearch 2 is your search engine, you must update to a more recent version. See the following resources to update Elasticsearch: 


  • Upgrading Elasticsearch provides full instructions on backing up your data, detecting potential migration issues, and testing upgrades before deploying to production. Depending on your current version of Elasticsearch, a full cluster restart may or may not be required 
  • Configure Magento to use Elasticsearch describes the tasks you need to perform after updating Elasticsearch 2 to a supported version. 



Installing 2.4.0 


You must have an Elasticsearch host set-up and configured prior to installing Magento.  You will not be able to continue the installation process until you successfully connect to Elasticsearch. 


As of Magento 2.4.0, you must install Magento from the command line. The bin/magento setup:install command includes several new flags that configure the connection to Elasticsearch: 





The version of Elasticsearch to use as the search engine. Possible values are elasticsearch7 and elasticsearch6. 


The host name or IP address where Elasticsearch is running. The default is localhost.  


The port for incoming HTTP requests. The default is 9200.  


A prefix that identifies the Elasticsearch index. The default is magento2.  


The number of seconds before the system times out. The default is 15.  


 Enables authentication on the Elasticsearch server. The default is false.  


 The user ID to authenticate Elasticsearch. 


 The password to authenticate Elasticsearch. 


If no Elasticsearch flags are provided, Magento uses the default search configuration. The command checks for an Elasticsearch connection. The installation fails if Magento is unable to connect to an Elasticsearch host. If this occurs, check that your Elasticsearch is up and running, and that you have supplied the correct connection parameters. 


sample install command might look like this: 



magento setup:install --base-url= \ 
--db-host=localhost --db-name=magento --db-user=magento --db-password=magento \ 
--admin-firstname=Magento --admin-lastname=User \ 
--admin-user=admin --admin-password=admin123 --language=en_US \ 
--currency=USD --timezone=America/Chicago --use-rewrites=1 \ 
--search-engine=elasticsearch7 \ 



Third-party search engines


Not all search extensions are created equal. Some search extensions do not replace Magento's search engine, opting to extend the functionality instead. If you are using such a search extension, Elasticsearch is still required. 


If you are using a search engine replacement, it is possible to upgrade to 2.4.0 without configuring an Elasticsearch server. 


To determine if your search solution replaces Magento's search engine, check the value of the catalog search engine (Stores > Configuration > Catalog > Catalog Search > Search Engine). 

If you experience any issues with search, please contact the search extension provider. 



Developer notes 


The following modules have been refactored to use the ElasticSearchResultApplier class and avoid usage of CatalogSearch SearchResultApplier which was based on mysql: 

  • CatalogGraphQL 
  • QuickOrder (B2B) 

In addition, the following constructors were modified to provide a mixed type. We have removed deprecated class private and protected components but have left their usages as arguments in the constructor for backwards compatibility. 


  • Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection 
  • Magento\CatalogSearch\Model\ResourceModel\Advanced\Collection 
  • Magento\CatalogSearch\Model\Indexer\Fulltext\Action\Full 


NoteWe recommend that you do not inherit from any Magento class. If your extension does inherit from any of the classes above, make sure it is not using any of the deprecated or removed mixed type class members. For compatibility, modify your constructors accordingly. 


The following deprecated interfaces were deletedIf your extension implements any of these interfaces, refactor your code to use the Elasticsearch module. 


  • Magento\Framework\Search\Adapter\Mysql\Query\Builder\QueryInterface 
  • Magento\CatalogSearch\Model\Search\FilterMapper\FilterStrategyInterface 


The following deprecated classes were deleted. If your extension uses any of the above classes, then you must do a major refactor to your code to use the Elasticsearch module, and not rely on MySQL Search class implementations. 


  • Magento\Framework\Search\Adapter\Mysql\DocumentFactory 
  • Magento\Framework\Search\Adapter\Mysql\Mapper 
  • Magento\Framework\Search\Adapter\Mysql\ScoreBuilder 
  • Magento\Framework\Search\Adapter\Mysql\Query\Builder\Match 
  • Magento\Framework\Search\Adapter\Mysql\Field\FieldFactory 
  • Magento\Framework\Search\Adapter\Mysql\Aggregation\Builder 
  • Magento\Framework\Search\Adapter\Mysql\Aggregation\DataProviderContainer 
  • Magento\CatalogSearch\Model\Search\TableMapper 
  • Magento\CatalogSearch\Model\Indexer\IndexerHandler 
  • Magento\CatalogSearch\Model\Indexer\ProductFieldset 
  • Magento\CatalogSearch\Model\Indexer\Scope\IndexTableNotExistException 
  • Magento\CatalogSearch\Model\Indexer\Fulltext\Action\IndexIterator 
  • Magento\CatalogSearch\Model\Adapter\Mysql\Filter\AliasResolver 
1 Comment