Cluster state REST api: print routing_nodes out only when requested through specific flag

For bacwards compatibility reasons routing_nodes were previously printed out when routing_table was requested, together with the actual routing_table. Now they are printed out only when requests through `routing_nodes` flag.

Relates to #10412
Closes #10486
This commit is contained in:
javanna 2015-04-08 15:46:49 +02:00 committed by Luca Cavanna
parent 174d141512
commit acabf2d55a
3 changed files with 8 additions and 3 deletions

View File

@ -371,3 +371,9 @@ over AJAX instead:
http.cors.enabled: true
http.cors.allow-origin: /https?:\/\/localhost(:[0-9]+)?/
---------------
=== Cluster state REST api
The cluster state api doesn't return the `routing_nodes` section anymore when
`routing_table` is requested. The newly introduced `routing_nodes` flag can
be used separately to control whether `routing_nodes` should be returned.

View File

@ -81,7 +81,7 @@ setup:
- is_false: nodes
- is_false: metadata
- is_true: routing_table
- is_true: routing_nodes
- is_false: routing_nodes
---
"Filtering the cluster state by routing nodes only should work":

View File

@ -464,8 +464,7 @@ public class ClusterState implements ToXContent {
}
// routing nodes
// gets printed out even if only routing_table was requested for bw comp reasons
if (metrics.contains(Metric.ROUTING_TABLE) || metrics.contains(Metric.ROUTING_NODES)) {
if (metrics.contains(Metric.ROUTING_NODES)) {
builder.startObject("routing_nodes");
builder.startArray("unassigned");
for (ShardRouting shardRouting : readOnlyRoutingNodes().unassigned()) {