# Connector to elastic server through Transport Client

**URL:** <https://discuss.elastic.co/t/connector-to-elastic-server-through-transport-client/51352>\
**Category:** Elasticsearch\
**Created:** [May 30, 2016, 10:44pm UTC](https://discuss.elastic.co/t/connector-to-elastic-server-through-transport-client/51352 "2016-05-30T22:44:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![omar\_romdhane](https://avatars.discourse-cdn.com/v4/letter/o/8dc957/32.png) [@omar\_romdhane](https://discuss.elastic.co/u/omar_romdhane)\
**Post date:** [May 30, 2016, 10:44pm UTC](https://discuss.elastic.co/t/connector-to-elastic-server-through-transport-client/51352/1 "2016-05-30T22:44:55Z")

</div>

Hi, i'm a student and i'm new in elasticsearch, i would like to develop a java web application that collects the data associated with a specific index  
So we must first develop a connection class to the elastic server using the java API (tansport-client) and then collect the data .  
I searched on google, but i didn't find any tutorial on how to collect the data from specifix index .  
i need help plz.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 31, 2016, 4:43am UTC](https://discuss.elastic.co/t/connector-to-elastic-server-through-transport-client/51352/2 "2016-05-31T04:43:21Z")

</div>

Did you read [https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/index.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/index.html) ?

---

<div class="post-metadata">

**Author:** ![omar\_romdhane](https://avatars.discourse-cdn.com/v4/letter/o/8dc957/32.png) [@omar\_romdhane](https://discuss.elastic.co/u/omar_romdhane)\
**Post date:** [May 31, 2016, 9:27am UTC](https://discuss.elastic.co/t/connector-to-elastic-server-through-transport-client/51352/3 "2016-05-31T09:27:23Z")

</div>

thanks dadoonet,

i tried to connect to my elasricsearch server (single node ) with this code , but i I get the following error  
i think that the connction is ok , but the problem with getting data from the index

my code :

import java.net.InetAddress;  
import java.net.UnknownHostException;

import org.elasticsearch.action.get.GetResponse;  
import org.elasticsearch.client.Client;  
import org.elasticsearch.client.transport.TransportClient;  
import org.elasticsearch.common.settings.Settings;  
import org.elasticsearch.common.transport.InetSocketTransportAddress;

> public class test {
> 
> static Client client = null ;

> public static void main(String args) {  
> // TODO Auto-generated method stub

> ```
> Settings settings = Settings.settingsBuilder()
> .put("cluster.name", "elasticsearch-cluster").build();
> try {
> client = TransportClient.builder().settings(settings).build().
> addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("10.206.206.82"), 9300));
> System.out.println("here1");
> 
> ```

> ```
> } catch (UnknownHostException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>   
> GetResponse response = client.prepareGet("logstash-2016.05.30", "log4j", "AVUCkWwGBTC2ElQBKf-2")
> .get();
>   
> System.out.println(response.toString());
>   
> client.close();
> 
> ```

> }  
> }

> mai 31, 2016 10:10:25 AM org.elasticsearch.plugins.PluginsService   
> INFOS: [Fafnir] modules , plugins , sites   
> here1  
> Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{10.206.206.82}{10.206.206.82:9300}]]  
> at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:290)  
> at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:207)  
> at org.elasticsearch.client.transport.support.TransportProxyClient.execute(TransportProxyClient.java:55)  
> at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:286)  
> at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:351)  
> at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:85)  
> at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:59)  
> at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:67)  
> at com.sagemcom.test.main(test.java:36)

---

<div class="post-metadata">

**Author:** ![omar\_romdhane](https://avatars.discourse-cdn.com/v4/letter/o/8dc957/32.png) [@omar\_romdhane](https://discuss.elastic.co/u/omar_romdhane)\
**Post date:** [May 31, 2016, 10:01am UTC](https://discuss.elastic.co/t/connector-to-elastic-server-through-transport-client/51352/4 "2016-05-31T10:01:24Z")

</div>

i fixed it when i disabled 'node.local: true ' in elasticsearch.yml 😀

---

<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:** [July 5, 2017, 10:47pm UTC](https://discuss.elastic.co/t/connector-to-elastic-server-through-transport-client/51352/5 "2017-07-05T22:47:45Z")

</div>


