Not able to connect to elastic host

I am trying to connect to the elastic running on a linux box from my local windows azure machine using below in java
Preformatted textTransportClient transportClient = (new PreBuiltTransportClient(Settings.EMPTY, new Class[0])).addTransportAddress(new TransportAddress(InetAddress.getByName(configFileReader.getElasticSearchHost()), configFileReader.getElasticSearchPort()));

I am getting an exception as below
error while posting test case info to elastic search: java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)

which is basically - java.net.UnknownHostException

elastic launches over the UI for me though , and its runign properly
please suggest what I am doing wrong ?

First, please use the High Level Rest Client instead of the TransportClient if you are on Elasticsearch 7.x

Second, please provide a full stack trace. From here it looks as if the host cannot resolve the name you provide. Can you test with the ip address instead just to rule out DNS issues?

1 Like