title: Elastic Search: Not able to connect to cluster with Java NodeBuilder Client
body: <p>I am trying to connect a client to ElasticSearch cluster and I am not able to get it working. I referred other questions here and in elastic search forum but none of the suggestions there helped me.</p>
  
  <p>I am able to telnet to each of elastic search nodes over port <code>9300</code>.</p>
  
  <p>Cluster status is green and I am able to connect using <code>TransportClient</code> without any issues.</p>
  
  <p>Code (Scala) :</p>
  
  <pre><code>  val immutableSettings = ImmutableSettings.settingsBuilder
      .put("node.name", "node-client")
      .put("http.enabled", "false")
      .put("index.number_of_shards", 5)
      .put("index.number_of_replicas", 3)
      .put("cluster.name", "my-cluster")
      .put("discovery.zen.ping.multicast.enabled", false)
      .putArray("discovery.zen.ping.unicast.hosts", "host1:9300", "host2:9300","host3:9300", "host4:9300", "host5:9300")
      .build
  
    lazy val node = NodeBuilder.nodeBuilder()
      .loadConfigSettings(false)
      .client(true)
      .settings(immutableSettings)
      .node()
  </code></pre>
  
  <p>Exception:</p>
  
  <pre><code>org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];[SERVICE_UNAVAILABLE/2/no master]
  </code></pre>
  
  <p>I understand this is because the client is not able to join the cluster but I am not able to figure out why.</p>
  
  <p>I checked logs in all of the 5 nodes and I don't see anything getting logged. And I also don't have enough permissions to change the logging level.</p>