# Java Node info

**URL:** <https://discuss.elastic.co/t/java-node-info/8805>\
**Category:** Elasticsearch\
**Created:** [August 21, 2012, 7:59pm UTC](https://discuss.elastic.co/t/java-node-info/8805 "2012-08-21T19:59:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)\
**Post date:** [August 21, 2012, 7:59pm UTC](https://discuss.elastic.co/t/java-node-info/8805/1 "2012-08-21T19:59:11Z")

</div>

I am trying to get the node info for a specific node. I have access to the java "Node" object for the node I want, but it appears the only way I can get info is via a NodeInfoRequest to the client. A NodeInfoRequest targets all nodes or the node id's specified. Is there a way for me to get the node id of a Node object or a NodeInfoResponse from a specific node object?

--  
Matt Weber  
Sent with Sparrow ([http://www.sparrowmailapp.com/?sig](http://www.sparrowmailapp.com/?sig))

--

---

<div class="post-metadata">

**Author:** ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)\
**Post date:** [August 21, 2012, 9:42pm UTC](https://discuss.elastic.co/t/java-node-info/8805/2 "2012-08-21T21:42:53Z")

</div>

I think I figured it out… is this the best approach?

String nodeId = ((InternalNode) node).injector().getInstance(ClusterService.class).state().nodes().localNodeId();  
client.admin().cluster().nodesInfo(new NodesInfoRequest(nodeId)).actionGet()

--  
Matt Weber  
Sent with Sparrow ([http://www.sparrowmailapp.com/?sig](http://www.sparrowmailapp.com/?sig))

On Tuesday, August 21, 2012 at 12:59 PM, Matt Weber wrote:

> I am trying to get the node info for a specific node. I have access to the java "Node" object for the node I want, but it appears the only way I can get info is via a NodeInfoRequest to the client. A NodeInfoRequest targets all nodes or the node id's specified. Is there a way for me to get the node id of a Node object or a NodeInfoResponse from a specific node object?
> 
> --  
> Matt Weber  
> Sent with Sparrow ([http://www.sparrowmailapp.com/?sig](http://www.sparrowmailapp.com/?sig))

--

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [August 21, 2012, 10:00pm UTC](https://discuss.elastic.co/t/java-node-info/8805/3 "2012-08-21T22:00:06Z")

</div>

Use \_local as the node id, it will give you the details of the local node.

On Aug 21, 2012, at 9:59 PM, Matt Weber [matt@mattweber.org](mailto:matt@mattweber.org) wrote:

> I am trying to get the node info for a specific node. I have access to the java "Node" object for the node I want, but it appears the only way I can get info is via a NodeInfoRequest to the client. A NodeInfoRequest targets all nodes or the node id's specified. Is there a way for me to get the node id of a Node object or a NodeInfoResponse from a specific node object?
> 
> --  
> Matt Weber  
> Sent with Sparrow
> 
> --

--

---

<div class="post-metadata">

**Author:** ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)\
**Post date:** [August 21, 2012, 10:32pm UTC](https://discuss.elastic.co/t/java-node-info/8805/4 "2012-08-21T22:32:00Z")

</div>

Perfect, thanks.

--  
Matt Weber  
Sent with Sparrow ([http://www.sparrowmailapp.com/?sig](http://www.sparrowmailapp.com/?sig))

On Tuesday, August 21, 2012 at 3:00 PM, Shay Banon wrote:

> Use \_local as the node id, it will give you the details of the local node.
> 
> On Aug 21, 2012, at 9:59 PM, Matt Weber \<[matt@mattweber.org](mailto:matt@mattweber.org) ([mailto:matt@mattweber.org](mailto:matt@mattweber.org))\> wrote:
> 
> > I am trying to get the node info for a specific node. I have access to the java "Node" object for the node I want, but it appears the only way I can get info is via a NodeInfoRequest to the client. A NodeInfoRequest targets all nodes or the node id's specified. Is there a way for me to get the node id of a Node object or a NodeInfoResponse from a specific node object?
> > 
> > --  
> > Matt Weber  
> > Sent with Sparrow ([http://www.sparrowmailapp.com/?sig](http://www.sparrowmailapp.com/?sig))
> > 
> > --
> 
> --

--

---

<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 6, 2017, 3:15am UTC](https://discuss.elastic.co/t/java-node-info/8805/5 "2017-07-06T03:15:33Z")

</div>


