I'm using olivere's elastic go library (https://godoc.org/gopkg.in/olivere/elastic.v5) to create a connection to elasticsearch like so:
addr = "http://172.17.0.2:9200"
client, err := elastic.NewClient(elastic.SetURL(addr))
and am getting this error:
health check timeout: no Elasticsearch node available
Elasticsearch is running in a docker container and I am able to curl it from both my local machine and from the docker container. However, the go code (running on the docker container) is not able to connect to it.
curl -s -XGET 'http://172.17.0.2:9200/_nodes/http?pretty=1'
{
"_nodes" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"cluster_name" : "elasticsearch",
"nodes" : {
"pGBN2DBISgSZ8hd9lFgmHw" : {
"name" : "pGBN2DB",
"transport_address" : "127.0.0.1:9300",
"host" : "127.0.0.1",
"ip" : "127.0.0.1",
"version" : "5.6.4",
"build_hash" : "8bbedf5",
"roles" : [
"master",
"data",
"ingest"
],
"http" : {
"bound_address" : [
"0.0.0.0:9200"
],
"publish_address" : "172.17.0.2:9200",
"max_content_length_in_bytes" : 104857600
}
}
}
}
I'm using Docker for Mac. The publish address and IP are off, not sure if that has something to do with it. Would appreciate any help!