# Not able to connect to elastic host

**URL:** <https://discuss.elastic.co/t/not-able-to-connect-to-elastic-host/278247>\
**Category:** Elasticsearch\
**Created:** [July 9, 2021, 7:26am UTC](https://discuss.elastic.co/t/not-able-to-connect-to-elastic-host/278247 "2021-07-09T07:26:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mac2](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@mac2](https://discuss.elastic.co/u/mac2)\
**Post date:** [July 9, 2021, 7:26am UTC](https://discuss.elastic.co/t/not-able-to-connect-to-elastic-host/278247/1 "2021-07-09T07:26:32Z")

</div>

I am trying to connect to the elastic running on a linux box from my local windows azure machine using below in java  
`Preformatted text`TransportClient 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 ?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 9, 2021, 8:23am UTC](https://discuss.elastic.co/t/not-able-to-connect-to-elastic-host/278247/2 "2021-07-09T08:23:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 6, 2021, 8:23am UTC](https://discuss.elastic.co/t/not-able-to-connect-to-elastic-host/278247/3 "2021-08-06T08:23:59Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
