add version and master_node flags to cluster state
This commit is contained in:
parent
152edd1804
commit
e5f43a1867
|
@ -27,10 +27,16 @@ $ curl -XGET 'http://localhost:9200/_cluster/state/{metrics}/{indices}'
|
|||
|
||||
`metrics` can be a comma-separated list of
|
||||
|
||||
`version`::
|
||||
Shows the cluster state version.
|
||||
|
||||
`master_node`::
|
||||
Shows the elected `master_node` part of the response
|
||||
|
||||
`nodes`::
|
||||
Shows the `nodes` part of the response
|
||||
|
||||
`routing_table`::
|
||||
`routing_table`::
|
||||
Shows the `routing_table` part of the response. If you supply a comma separated list of indices, the returned output will only contain the indices listed.
|
||||
|
||||
`metadata`::
|
||||
|
|
|
@ -235,7 +235,11 @@ public class ClusterState implements ToXContent {
|
|||
Set<String> metrics = Strings.splitStringByCommaToSet(params.param("metric", "_all"));
|
||||
boolean isAllMetricsOnly = metrics.size() == 1 && metrics.contains("_all");
|
||||
|
||||
if (isAllMetricsOnly || metrics.contains("nodes")) {
|
||||
if (isAllMetricsOnly || metrics.contains("version")) {
|
||||
builder.field("version", version);
|
||||
}
|
||||
|
||||
if (isAllMetricsOnly || metrics.contains("master_node")) {
|
||||
builder.field("master_node", nodes().masterNodeId());
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public class RestClusterStateAction extends BaseRestHandler {
|
|||
Set<String> metrics = Strings.splitStringByCommaToSet(request.param("metric", "_all"));
|
||||
boolean isAllMetricsOnly = metrics.size() == 1 && metrics.contains("_all");
|
||||
if (!isAllMetricsOnly) {
|
||||
clusterStateRequest.nodes(metrics.contains("nodes"));
|
||||
clusterStateRequest.nodes(metrics.contains("nodes") || metrics.contains("master_node"));
|
||||
clusterStateRequest.routingTable(metrics.contains("routing_table"));
|
||||
clusterStateRequest.metaData(metrics.contains("metadata"));
|
||||
clusterStateRequest.blocks(metrics.contains("blocks"));
|
||||
|
|
Loading…
Reference in New Issue