# How to determine elected master from INodesStatsResponse with the Nest client

**URL:** <https://discuss.elastic.co/t/how-to-determine-elected-master-from-inodesstatsresponse-with-the-nest-client/300739>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [March 26, 2022, 5:08am UTC](https://discuss.elastic.co/t/how-to-determine-elected-master-from-inodesstatsresponse-with-the-nest-client/300739 "2022-03-26T05:08:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jthoni](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@jthoni](https://discuss.elastic.co/u/jthoni)\
**Post date:** [March 26, 2022, 5:08am UTC](https://discuss.elastic.co/t/how-to-determine-elected-master-from-inodesstatsresponse-with-the-nest-client/300739/1 "2022-03-26T05:08:32Z")

</div>

I am using the Nest client to monitor my cluster. One thing I can't seem to figure out is how to determine if a given master-eligible node is the elected master. I am running this code on the physical VM where Elasticsearch is running:

```auto
// Set up filter for current node
NodeIds nodeIds = new NodeIds(new List<string> { this.IpAddress });
NodesStatsRequest nodeRequest = new NodesStatsRequest(nodeIds);

// Query for the current node's stats
INodesStatsResponse nodeStats = await this.Client.NodesStatsAsync(nodeRequest, cancellationToken).ConfigureAwait(false);

```

I can get all the information I want for logging from nodeStats, with the exception of being able to tell if the node is the elected master. If I curl (contrived example as I am debugging this locally with three instances running. In production, we have 40 separate VMs):

```auto
_cat/nodes?v&s=name

ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
127.0.0.1 29 93 74 di - data-1
127.0.0.1 34 93 69 di - data-2
127.0.0.1 23 93 69 mi * master-1

```

The "\*" under "master" identifies that it is elected. How can I get this via Nest?

Thanks!

---

<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:** [April 23, 2022, 5:09am UTC](https://discuss.elastic.co/t/how-to-determine-elected-master-from-inodesstatsresponse-with-the-nest-client/300739/2 "2022-04-23T05:09:22Z")

</div>

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