2
votes

I have elasticsearch (not installed as service) on AWS ubuntu 16. I am trying to connect it to my node application but I am getting connection refused.

curl -XGET '52.x.x.x:9200/_cat/indices?v&pretty' also fetches me connection refused.

Things I have tried: updating the network host in elasticsearch.yaml to 0.0.0.0

3
Check if elasticsearch is listening on port 9200. - heemayl
yes, elasticsearch is listening on port 9200. When I put localhost instead of public ip of aws ec2 i.e 52.x.x.x, I get a proper response. - Abhi
can you attach log files of elastic and complete error when you try curl command - user3775217

3 Answers

4
votes

1st see if your firewall has an open 9200 port.

2nd in elasticsearch.yaml set network.host to 52.x.x.x and save it.

3th restart elasticsearch service: service elasticsearch restart

4th test it: curl -X GET 'http://52.x.x.x:9200'

3
votes

You should set the item network.host in conf/elasticsearch.yml file as:

network.host: 52.x.x.x 

and restart the elasticsearch. The default value of network.host is localhost, so you can visit elasticsearch in localhost.

-2
votes

1st see if your firewall has an open 9200 port.

2nd in elasticsearch.yaml set network.host to 52.x.x.x and save it.

3th restart elasticsearch service: service elasticsearch restart

4th test it: curl -X GET 'http://52.x.x.x:9200'

You should set the item network.host in conf/elasticsearch.yml file as:

network.host: 52.x.x.x 

and restart the elasticsearch. The default value of network.host is localhost, so you can visit elasticsearch in localhost.