Elastic Search
Description
Hello - Is there a specific config we have to do for Elastic search to work? I am on 2.4.2. here is my elastic search config in env.php
'system' => [
'default' => [
'catalog' => [
'search' => [
'engine' => 'elasticsearch7',
'elasticsearch7_server_hostname' => 'localhost',
'elasticsearch7_server_port' => '9200'
]
]
]
],
Steps To Reproduce
- Run bin/magento setup:upgrade
Expected Result
Could not validate a connection to Elasticsearch. No alive nodes found in your cluster

Actual Result
Doing a curl http://localhost:9200 { "name" : "cce87c07a8c9", "cluster_name" : "docker-cluster", "cluster_uuid" : "1wXuW-BmT46E6BYxd750ag", "version" : { "number" : "7.7.1", "build_flavor" : "default", "build_type" : "docker", "build_hash" : "ad56dce891c901a492bb1ee393f12dfff473a423", "build_date" : "2020-05-28T16:30:01.040088Z", "build_snapshot" : false, "lucene_version" : "8.5.1", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" }
Entry in db attached

I also updated my env.php with the below
'system' => [
'default' => [
'catalog' => [
'search' => [
'elasticsearch7_server_hostname' => 'elasticsearch'
]
]
]
],
But same issue, any ideas?
I'm unable to replicate, a fresh install of docker-magento can successfully run bin/magento setup:upgrade. No changes needed at all to env.php (if you did make changes, back them out).
curl http://localhost:9200 showing a success response also means that the elasticsearch container is up and running.
I have the same issue. It was working fine and suddenly stop working :(
curl http://localhost:9200 hits well
Any solution @niketkanoi ?