Skip to content

Developer notes

Blair Learn edited this page Dec 9, 2021 · 2 revisions

Debugging against Elasticsearch

It is possible to configure Elasticsearch such that it can be used by an API instance which is running in a container.

Because we use the SniffingConnectionPool for our connections, Elasticsearch publishes the name/IP address of the server the client should connect to. When running in a Docker container (as in our integration tests) it publishes the container's IP address, which is on a separate network and not reachable by the client.

The solution to this is to set http.publish_host=localhost via an environment variable on container start up. (Normally it defaults to the container's internal name elasticsearch, which is unavailable outside the container.

NOTE: Historically, http.publish_host hasn't been completely reliable, which is why this is not our normal configuration. Additionally, http. publish_host may only be set to a single value, preventing it from being configured for both elasticsearch and localhost.

See also:

Clone this wiki locally