Connector to elastic server through Transport Client

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.

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

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)

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