Skip to content

Commit

Permalink
Add a field discovered_cluster_manager in get cluster health api
Browse files Browse the repository at this point in the history
Signed-off-by: Tianli Feng <ftianli@amazon.com>
  • Loading branch information
Tianli Feng committed Mar 11, 2022
1 parent b00b3ce commit 0148e0e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,16 @@
cluster.health:
index: index-2
- match: { status: yellow }

---
"Get cluster health has same value for discovered_master and discovered_cluster_manager":
- skip:
version: " - 1.4.99"
reason: "discovered_cluster_manager is added in 2.0.0"
- do:
cluster.health: {}
- set:
discovered_master: discovered_or_not

- match: { discovered_master: $discovered_or_not }
- match: { discovered_cluster_manager: $discovered_or_not }
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo
private static final String NUMBER_OF_NODES = "number_of_nodes";
private static final String NUMBER_OF_DATA_NODES = "number_of_data_nodes";
private static final String DISCOVERED_MASTER = "discovered_master";
private static final String DISCOVERED_CLUSTER_MANAGER = "discovered_cluster_manager";
private static final String NUMBER_OF_PENDING_TASKS = "number_of_pending_tasks";
private static final String NUMBER_OF_IN_FLIGHT_FETCH = "number_of_in_flight_fetch";
private static final String DELAYED_UNASSIGNED_SHARDS = "delayed_unassigned_shards";
Expand Down Expand Up @@ -376,7 +377,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
builder.field(TIMED_OUT, isTimedOut());
builder.field(NUMBER_OF_NODES, getNumberOfNodes());
builder.field(NUMBER_OF_DATA_NODES, getNumberOfDataNodes());
builder.field(DISCOVERED_MASTER, hasDiscoveredMaster());
builder.field(DISCOVERED_MASTER, hasDiscoveredMaster()); // the field will be removed in a future major version
builder.field(DISCOVERED_CLUSTER_MANAGER, hasDiscoveredMaster());
builder.field(ACTIVE_PRIMARY_SHARDS, getActivePrimaryShards());
builder.field(ACTIVE_SHARDS, getActiveShards());
builder.field(RELOCATING_SHARDS, getRelocatingShards());
Expand Down

0 comments on commit 0148e0e

Please sign in to comment.