When performing the setup:upgrade I get this error :

"Could not validate a connection to Elasticsearch. No alive nodes found in your cluster"

I have not enabled It previously, updating from Magento 2.3.5 p1.

  • Please make sure, you are using default magento MySQL search. Admin login >> Store >> Configuration >> Catalog >> Catalog search >> Engin it should be Mysql >> Save.
    – Nits
    Commented Jul 30, 2020 at 12:51
  • MySql search is removed from M2.4, set Elasticsearch engine from Store >> Configuration >> Catalog >> Catalog search >> Engin
    – Sohel Rana
    Commented Jul 30, 2020 at 13:22
  • Thanks, your response was cut off. What value do I set this to if I dont want elastic search.
    – V. Long
    Commented Jul 30, 2020 at 16:47

6 Answers 6


You must enable ElasticSearch in Magento 2.4, it's a requirement as you can see in the page Magento 2.4 technology stack requirements.

You should use ElastiSearch 7, not ElasticSearch 6 as Magento 2.3

First, check if your ElasticSearch in installed and running, you can do via admin panel in the page Stores > Settings > Configuration > Catalog > Catalog > Catalog Search, and click in the test button.

Magento 2.4 ElasticSearch 7

Or using this command below, if required you can change the localhost and port.

curl -XGET 'localhost:9200/my_index/my_type/_search' -d '{
  "query" : {
    "match" : {
      "testField" : "abc"

Via terminal, you can check which search engine you're using today and set it to ElasticSearch 7.

bin/magento config:show catalog/search/engine
bin/magento config:set catalog/search/engine elasticsearch7

I guess I have just found my anser, according to the following:

"MySQL is no longer used for search. You must use Elasticsearch.

You must install and configure Elasticsearch 7.6.x before upgrading to Magento 2.4.0. New installations require a connection to Elasticsearch to complete."

So I will need to stop and get familiar with elastic search, did I mention I couldnt log in to admin because of 2fa was enabled? And by the way had to learn the command line for installing.

With M1 going away and M2 replacing, it seems there are still major changes that effect the backward compatibility of the product. Im glad I only have M1 production product right now, but trying to get to M2. Seems every release provides new surprises with changes to functionality , prerequisites that takes me days to install and get working.

love it


Seem that your elasticsearch hostname is invalid. Try to find this path:


on you core_config_data table and correct it with your host name. For example, if you install your project on local host, set value to:


If you are using Magento 2.4.x then you should be using ElasticSearch 7.

Check app/etc/env.php for ElasticSearch settings.


'system' => [
        'default' => [
            'catalog' => [
                'search' => [
                    'engine' => 'elasticsearch6',
                    'elasticsearch6_server_hostname' => 'opensearch',
                    'elasticsearch6_server_port' => '9200',
                    'elasticsearch6_index_prefix' => 'magento'

If you see elasticsearch6, then change those to elasticsearch7.

Like this:

'system' => [
        'default' => [
            'catalog' => [
                'search' => [
                    'engine' => 'elasticsearch7',
                    'elasticsearch7_server_hostname' => 'opensearch',
                    'elasticsearch7_server_port' => '9200',
                    'elasticsearch7_index_prefix' => 'magento'

Run config import:

bin/magento app:config:import

Refresh Cache:

bin/magento cache:flush

Now, bin/magento setup:upgrade should run fine.


if you are using https://github.com/markshust/docker-magento#setup make sure to not put localhost:9200 in the servers list as this is visbile to your host machine but if you do enter image description here so the correct settings are enter image description here


Run bin/magento config:show catalog/search/engine if you then get the value mysql change it to Elasticsearch by running bin/magento config:set catalog/search/engine elasticsearch7.

Than you can run the setup:upgrade command again.

  • I did run config:show, it came back with no entry. Im upgrading from a 2.3.5 database. Entered command to change to elasticsearch7 and it added. Apparently 2.4 defaults to elastic search because when I run the setup it states the same error. I dont have an elastic server setup. What value goes into this configuration. I did try mysql and of course got the message its not supported. Ive not had experience with elasticsearch, but assume it takes an external server. I dont want to set that up.
    – V. Long
    Commented Jul 30, 2020 at 16:37
  • Well in that case the error appear because you do not have Elasticsearch running on your server. Sinds 2.4 Magento no longer support mysql as search engine and it is required to use Elastic. So to upgrade from 2.3.5 you need to install Elasticsearch 7+ to your server.
    – JGeer
    Commented Jul 31, 2020 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.