-
Notifications
You must be signed in to change notification settings - Fork 5
Developer notes
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:
- Elasticsearch sniffing best practices (Includes information about the Docker scenario.)
- Elasticsearch HTTP settings
- Elasticsearch Networking
- Issue #162