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 ?

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 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("", "elasticsearch-cluster").build();
  try {
  	client = TransportClient.builder().settings(settings).build().
  			addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(""), 9300));
  } catch (UnknownHostException e) {
  	// TODO Auto-generated catch block
  GetResponse response = client.prepareGet("logstash-2016.05.30", "log4j", "AVUCkWwGBTC2ElQBKf-2")


mai 31, 2016 10:10:25 AM org.elasticsearch.plugins.PluginsService
INFOS: [Fafnir] modules [], plugins [], sites []
Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{}{}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(
at org.elasticsearch.client.transport.TransportClientNodesService.execute(
at org.elasticsearch.client.transport.TransportClient.doExecute(
at org.elasticsearch.action.ActionRequestBuilder.execute(
at org.elasticsearch.action.ActionRequestBuilder.execute(
at org.elasticsearch.action.ActionRequestBuilder.get(
at com.sagemcom.test.main(

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