How to diagnose «Could not validate a connection to Elasticsearch. No alive nodes found in your cluster»?

Step 1

Ensure that Elasticsearch has alive nodes:

http://<host>:<port>/_cat/nodes?v

Step 2

Check Magento settings for Elasticsearch.
The code below is for Elasticsearch 7:

(
	declare -a o=(
	   'catalog/search/engine'
	   'catalog/search/elasticsearch7_index_prefix'
	   'catalog/search/elasticsearch7_server_hostname'
	   'catalog/search/elasticsearch7_server_port'
	)
	for k in "${o[@]}"; do
	   printf "$k: $(bin/magento config:show "$k")\n"
	done
)