Error Upgrade Magento 2.4.6 to Elasticsearch 8.x throwing error “Could not validate a connection”.

This is common error as by default Magento supports Elasticsearch 7.x so far. You need to install official Magento Elasticserach extension via composer and then disable modules and enable back the modules (except opensearch). Run below commands one by one and you will able to fix this.

composer require magento/module-elasticsearch-8 --with-all-dependencies
bin/magento setup:install --disable-modules=Magento_InventoryElasticsearch,Magento_Elasticsearch8,Magento_Elasticsearch,Magento_OpenSearch
bin/magento module:enable Magento_InventoryElasticsearch Magento_Elasticsearch8 Magento_Elasticsearch
bin/magento config:set catalog/search/engine 'elasticsearch8'
bin/magento setup:upgrade
bin/magento setup:di:compile

Updated : 05 Apr 24

Knowledge Bites

Scroll to Top