# Elasticsearch 5 TransportClient java api

**URL:** <https://discuss.elastic.co/t/elasticsearch-5-transportclient-java-api/69517>\
**Category:** Elasticsearch\
**Created:** [December 20, 2016, 3:55am UTC](https://discuss.elastic.co/t/elasticsearch-5-transportclient-java-api/69517 "2016-12-20T03:55:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TTNarendran](https://avatars.discourse-cdn.com/v4/letter/t/59ef9b/32.png) [@TTNarendran](https://discuss.elastic.co/u/TTNarendran)\
**Post date:** [December 20, 2016, 3:55am UTC](https://discuss.elastic.co/t/elasticsearch-5-transportclient-java-api/69517/1 "2016-12-20T03:55:13Z")

</div>

TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)  
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host1"), 9300))  
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("host2"), 9300));

Whether it is necessary to include all the node IP suppose i have 3 nodes one data , client , master nodes or enough to include only the data/client node IP.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [December 20, 2016, 6:32pm UTC](https://discuss.elastic.co/t/elasticsearch-5-transportclient-java-api/69517/2 "2016-12-20T18:32:19Z")

</div>

You might be interested to read about the sniffing option of the transport client, which allows it to discover other nodes of the cluster. [https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html)

---

<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:** [January 17, 2017, 6:32pm UTC](https://discuss.elastic.co/t/elasticsearch-5-transportclient-java-api/69517/3 "2017-01-17T18:32:27Z")

</div>

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