title: Elasticsearch TransportClient connection [Java]
body: <p>I am using <strong>Elasticsearch</strong> in a <strong>Java Project</strong> using <strong>Maven</strong>:</p>
  
  <pre><code>...
   &lt;elasticsearch.version&gt;6.7.0&lt;/elasticsearch.version&gt;
  ...
      &lt;!-- Elasticsearch --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.elasticsearch&lt;/groupId&gt;
          &lt;artifactId&gt;elasticsearch&lt;/artifactId&gt;
          &lt;version&gt;${elasticsearch.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.elasticsearch.client&lt;/groupId&gt;
          &lt;artifactId&gt;transport&lt;/artifactId&gt;
          &lt;version&gt;${elasticsearch.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.elasticsearch.plugin&lt;/groupId&gt;
          &lt;artifactId&gt;transport-netty4-client&lt;/artifactId&gt;
          &lt;version&gt;${elasticsearch.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-to-slf4j&lt;/artifactId&gt;
          &lt;version&gt;2.8.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- Elasticsearch --&gt;        
  </code></pre>
  
  <p>When I try to initialize a TransportClient in order to index a document it gives me the error:</p>
  
  <pre><code>    NoNodeAvailableException[None of the configured nodes are available: 
      [{#transport#-1}{BHMBbfcrSUOM_Pyaf1LcnA}{localhost}{127.0.0.1:9300}]]
  </code></pre>
  
  <p>Maybe a need to add more information in config/elasticsearch.yaml about transportartion or the current configuration is wrong.</p>
  
  <p><strong>Java code:</strong></p>
  
  <pre><code>    TransportAddress address;
      TransportClient client;
      Settings settings;
  
      try {
          address = new TransportAddress(InetAddress.getByName("localhost"), 9300);
          settings = Settings
                      .builder()
                      .put("cluster.name", "lib2life")
                      .put("client.transport.sniff", true)
                      .build();
  
          /* Initiate Transport Client */
          client = new PreBuiltTransportClient(settings)
                      .addTransportAddress(address);
  
          /* Verify it cluster is healthy */
          ClusterHealthResponse clusterResponse = client
                      .admin()
                      .cluster()
                      .prepareHealth()
                      .setWaitForGreenStatus()
                      .setTimeout(TimeValue.timeValueSeconds(5))
                      .execute() //Error here
                      .actionGet();
  
           ... (more code)
      }
  </code></pre>
  
  <p><strong>elasticsearch.yaml:</strong></p>
  
  <pre><code># ---------------------------------- Cluster -----------------------------------
  #
  # Use a descriptive name for your cluster:
  #
  cluster.name: lib2life
  #
  # ---------------------------------- Network -----------------------------------
  #
  # Set the bind address to a specific IP (IPv4 or IPv6):
  #
  #network.host: 192.168.0.1
  
  network.host:localhost
  network.transport.tcp.port:9300
  
  #
  # Set a custom port for HTTP:
  #
  #http.port: 9200
  #
  # For more information, consult the network module documentation.
  #
  </code></pre>
  
  <p>(The other info inside elasticsearch.yaml is commented)</p>
  
  <p><strong>localhost:9200</strong> gives me:</p>
  
  <pre><code>{
    "name" : "IRINAMW7",
    "cluster_name" : "lib2life",
    "cluster_uuid" : "-wL1-xdESnyoknD2ZqALDQ",
    "version" : {
      "number" : "7.1.1",
      "build_flavor" : "default",
      "build_type" : "zip",
      "build_hash" : "7a013de",
      "build_date" : "2019-05-23T14:04:00.380842Z",
      "build_snapshot" : false,
      "lucene_version" : "8.0.0",
      "minimum_wire_compatibility_version" : "6.8.0",
      "minimum_index_compatibility_version" : "6.0.0-beta1"
    },
    "tagline" : "You Know, for Search"
  }
  </code></pre>