How to determine elected master from INodesStatsResponse with the Nest client

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:

// 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):

_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!

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