# ES node client

**URL:** <https://discuss.elastic.co/t/es-node-client/88478>\
**Category:** Elasticsearch\
**Created:** [June 6, 2017, 9:46pm UTC](https://discuss.elastic.co/t/es-node-client/88478 "2017-06-06T21:46:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![satyajit\_vegesna](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@satyajit\_vegesna](https://discuss.elastic.co/u/satyajit_vegesna)\
**Post date:** [June 6, 2017, 9:46pm UTC](https://discuss.elastic.co/t/es-node-client/88478/1 "2017-06-06T21:46:41Z")

</div>

Hi All,

Can anyone help me understand if there is method/way to check, if the node client has connection to cluster or not.  
Or a method similar to get connectednodes() used for transport client.

The whole idea, is to check if there is way to understand the client object connection is still up/connected to cluster/node or not.

Regards,  
Satyajit.

---

<div class="post-metadata">

**Author:** ![ugosan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ugosan/32/18916_2.png) [@ugosan](https://discuss.elastic.co/u/ugosan)\
**Post date:** [June 6, 2017, 10:35pm UTC](https://discuss.elastic.co/t/es-node-client/88478/2 "2017-06-06T22:35:20Z")

</div>

You might access `http://your_node_ip:9200/_nodes/stats/os,process?pretty` and will have statistics about how many nodes are connected to your cluster.

Every node will print information about the cluster it is connected to, so you might use the IP of any node in your cluster to check.

---

<div class="post-metadata">

**Author:** ![satyajit\_vegesna](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@satyajit\_vegesna](https://discuss.elastic.co/u/satyajit_vegesna)\
**Post date:** [June 6, 2017, 10:46pm UTC](https://discuss.elastic.co/t/es-node-client/88478/3 "2017-06-06T22:46:29Z")

</div>

Okay, is there a way to call the same through Node client api??(Java)

---

<div class="post-metadata">

**Author:** ![ugosan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ugosan/32/18916_2.png) [@ugosan](https://discuss.elastic.co/u/ugosan)\
**Post date:** [June 6, 2017, 11:05pm UTC](https://discuss.elastic.co/t/es-node-client/88478/4 "2017-06-06T23:05:04Z")

</div>

Yes, you might use:

```
ClusterHealthResponse healths = client.admin().cluster().prepareHealth().get(); 
String clusterName = healths.getClusterName();              
int numberOfDataNodes = healths.getNumberOfDataNodes();     
int numberOfNodes = healths.getNumberOfNodes();             

for (ClusterIndexHealth health : healths.getIndices().values()) { 
String index = health.getIndex();                       
int numberOfShards = health.getNumberOfShards();        
int numberOfReplicas = health.getNumberOfReplicas();    
ClusterHealthStatus status = health.getStatus();        
}

```

take a look at the docs here: [https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-admin-cluster.html](https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-admin-cluster.html)

---

<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 4, 2017, 11:05pm UTC](https://discuss.elastic.co/t/es-node-client/88478/5 "2017-07-04T23:05:10Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
