Elasticsearch 2.0, Accessing via public IP

Since Elasticsearch 2.0 only works on localhost as a security you might need to access Elasticsearch 2.0 from Public IP for development purposes.






Hi, so as the part of team, I was responsible for upgrading elasticsearch. In our project we were feeding elasticsearch with processed data from mysql so it was not important to save data. So I simply installed ES2.0 and since we are still developing the project we were accessing ES via public IP. But as soon as we upgraded we could not longer access ES via http://<public_IP>:9200. This is because ES2 binds to localhost by default.

Solution

edit file /etc/elasticsearch/elasticsearch.yml

update the following value for network.host: to

network.host: 0.0.0.0

restart you elasticsearch instance and you are good to go.

NOTE: This setting is only for test servers and not at all recommended for production servers.
  • madAndroid

    Nice article, thanks 🙂 it’s also worth mentioning that this is necessary in a clustered environment as well – without allowing traffic from other nodes, the clustering won’t work.

  • thanks