Unable to connect | 502 Bad Gateway on Enterprise Search

Hello community, this morning I was trying to setup Enterprise Search(Appsearch) with docker, following the URL, https://www.elastic.co/guide/en/enterprise-search/8.1/docker.html, nothing changed just copied and pasted the .env and docker-compose.yml file content in the above link.
Below is the docker -compose status, appsearch_enterprisesearch_1 and appsearch_setup_1 exits after few seconds while the othe two appsearch_es01_1 and appsearch_kibana_1 are up and running state.

---------------------------------------------------------------------------------------------------------------
appsearch_enterprisesearch_1   /bin/tini -- /usr/local/bi ...   Exit 1                                         
appsearch_es01_1               /bin/tini -- /usr/local/bi ...   Up (healthy)   0.0.0.0:9200->9200/tcp, 9300/tcp
appsearch_kibana_1             /bin/tini -- /usr/local/bi ...   Up (healthy)   0.0.0.0:5601->5601/tcp          
appsearch_setup_1              /bin/tini -- /usr/local/bi ...   Exit 0

appsearch_enterprisesearch_1 Logs

Overwriting the default Enterprise Search configuration file: /usr/share/enterprise-search/config/enterprise-search.yml (if it fails, please make sure it is writeable)

Found java executable in PATH

Java version detected: 11.0.10 (major version: 11)

Enterprise Search is starting...

[2022-04-27T06:48:00.820+00:00][7][2000][app-server][INFO]: Elastic Enterprise Search version=8.1.3, JRuby version=9.2.16.0, Ruby version=2.5.7, Rails version=5.2.6

[2022-04-27T06:48:02.119+00:00][7][2000][app-server][INFO]: Performing pre-flight checks for Elasticsearch running on https://es01:9200...

Unexpected exception while running Enterprise Search:

Error: es01: Name or service not known at /usr/share/enterprise-search/lib/war/gems/gems/manticore-0.7.0-java/lib/faraday/adapter/manticore.rb:88:in `block in call'

/usr/share/enterprise-search/lib/war/gems/gems/manticore-0.7.0-java/lib/manticore/response.rb:79:in `call'

/usr/share/enterprise-search/lib/war/gems/gems/manticore-0.7.0-java/lib/faraday/adapter/manticore.rb:92:in `call'

/usr/share/enterprise-search/lib/war/lib/middleware/request_logging_middleware.class:26:in `call'

/usr/share/enterprise-search/lib/war/gems/gems/faraday-1.8.0/lib/faraday/rack_builder.rb:154:in `build_response'

/usr/share/enterprise-search/lib/war/gems/gems/faraday-1.8.0/lib/faraday/connection.rb:516:in `run_request'

/usr/share/enterprise-search/lib/war/gems/gems/faraday-1.8.0/lib/faraday/connection.rb:200:in `get'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/elasticsearch.class:557:in `block in get_raw'

/usr/share/enterprise-search/lib/war/lib/apm_helpers.class:41:in `es_action_instrument'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/elasticsearch.class:639:in `instrument'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/elasticsearch.class:556:in `get_raw'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/elasticsearch_checks.class:142:in `check_es_connection_with_retries!'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/elasticsearch_checks.class:32:in `check_es_connection!'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/elasticsearch_checks.class:19:in `block in run!'

/usr/share/enterprise-search/lib/war/gems/gems/activesupport-5.2.6/lib/active_support/tagged_logging.rb:71:in `block in tagged'

/usr/share/enterprise-search/lib/war/gems/gems/activesupport-5.2.6/lib/active_support/tagged_logging.rb:28:in `tagged'

/usr/share/enterprise-search/lib/war/gems/gems/activesupport-5.2.6/lib/active_support/tagged_logging.rb:71:in `tagged'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/elasticsearch_checks.class:18:in `run!'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/elasticsearch_checks.class:14:in `run!'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo.class:289:in `configure_elasticsearch!'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo.class:268:in `configure!'

/usr/share/enterprise-search/lib/war/config/application.class:20:in `<main>'

org/jruby/RubyKernel.java:1016:in `load'

/usr/share/enterprise-search/lib/war/gems/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:285:in `block in load'

/usr/share/enterprise-search/lib/war/gems/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:257:in `load_dependency'

/usr/share/enterprise-search/lib/war/gems/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:285:in `load'

/usr/share/enterprise-search/lib/war/config/application.rb:1:in `<main>'

org/jruby/RubyKernel.java:974:in `require'

/usr/share/enterprise-search/lib/war/gems/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in `block in require'

/usr/share/enterprise-search/lib/war/gems/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:257:in `load_dependency'

/usr/share/enterprise-search/lib/war/gems/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in `require'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli/command.class:36:in `initialize'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli/command.class:10:in `run_and_exit'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli.class:143:in `run_supported_command'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli.class:125:in `run_command'

/usr/share/enterprise-search/lib/war/shared_togo/lib/shared_togo/cli.class:112:in `run!'

bin/enterprise-search-internal:15:in `<main>'

appsearch_setup_1 Logs

Creating CA
Archive:  config/certs/ca.zip
   creating: config/certs/ca/
  inflating: config/certs/ca/ca.crt  
  inflating: config/certs/ca/ca.key  
Creating certs
Archive:  config/certs/certs.zip
   creating: config/certs/es01/
  inflating: config/certs/es01/es01.crt  
  inflating: config/certs/es01/es01.key  
Setting file permissions
Waiting for Elasticsearch availability
Setting kibana_system password
All done!
Creating CA
bash: line 10: bin/elasticsearch-certutil: Permission denied
Archive:  config/certs/ca.zip
replace config/certs/ca/ca.crt? [y]es, [n]o, [A]ll, [N]one, [r]ename:  NULL
(EOF or read error, treating as "[N]one" ...)
Creating certs
bash: line 24: bin/elasticsearch-certutil: Permission denied
Archive:  config/certs/certs.zip
replace config/certs/es01/es01.crt? [y]es, [n]o, [A]ll, [N]one, [r]ename:  NULL
(EOF or read error, treating as "[N]one" ...)
Setting file permissions
Waiting for Elasticsearch availability
Setting kibana_system password
All done!

Below is the attached screenshot;

Hi @auasad,

It looks like Enterprise Search is failing when trying to connect to Elasticsearch.

Can you confirm your Elasticsearch instance is running, is healthy, and that Enterprise Search has the correct Elasticsearch endpoint and credentials in the config file?

Thanks,
Brian

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.