0
0
Elasticsearchquery~20 mins

Cluster health API in Elasticsearch - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Cluster Health Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:30remaining
What is the output of this cluster health API call?
Given the following Elasticsearch cluster health API request, what is the value of the status field in the response?
Elasticsearch
GET /_cluster/health

Response example:
{
  "cluster_name": "my_cluster",
  "status": "green",
  "timed_out": false,
  "number_of_nodes": 3,
  "number_of_data_nodes": 2,
  "active_primary_shards": 10,
  "active_shards": 20,
  "relocating_shards": 0,
  "initializing_shards": 0,
  "unassigned_shards": 0
}
A"blue"
B"yellow"
C"red"
D"green"
Attempts:
2 left
💡 Hint
Look at the status field in the JSON response.
🧠 Conceptual
intermediate
1:30remaining
What does the unassigned_shards field indicate in cluster health?
In the Elasticsearch cluster health API response, what does the unassigned_shards field represent?
AThe number of nodes that are down
BThe number of shards that are not allocated to any node
CThe total number of shards in the cluster
DThe number of shards currently relocating between nodes
Attempts:
2 left
💡 Hint
Think about shards that are missing or waiting to be assigned.
Predict Output
advanced
1:30remaining
What is the output of this filtered cluster health API call?
Given this request to get cluster health only for the index logs-2023, what will be the value of active_shards in the response?
Elasticsearch
GET /_cluster/health/logs-2023

Response example:
{
  "cluster_name": "my_cluster",
  "status": "yellow",
  "timed_out": false,
  "number_of_nodes": 3,
  "number_of_data_nodes": 2,
  "active_primary_shards": 5,
  "active_shards": 7,
  "relocating_shards": 1,
  "initializing_shards": 0,
  "unassigned_shards": 2
}
A7
B5
C2
D0
Attempts:
2 left
💡 Hint
Check the active_shards field in the response.
Predict Output
advanced
1:30remaining
What error does this invalid cluster health API request produce?
What error will this request produce? GET /_cluster/health?level=invalid_level
Elasticsearch
GET /_cluster/health?level=invalid_level
A404 Not Found error
B200 OK with default cluster health response
C400 Bad Request with error about invalid level parameter
D500 Internal Server Error
Attempts:
2 left
💡 Hint
The level parameter accepts only specific values like cluster, indices, or shards.
🧠 Conceptual
expert
2:00remaining
How does the cluster health API determine the overall cluster status?
Which of the following best describes how Elasticsearch determines the overall status field in the cluster health API response?
AIt is green if all primary and replica shards are allocated, yellow if all primary shards are allocated but some replicas are unassigned, and red if any primary shard is unassigned
BIt is green if all nodes are up, yellow if any node is down, and red if the master node is down
CIt is green if the cluster has no unassigned shards, yellow if there are relocating shards, and red if there are initializing shards
DIt is green if the cluster has less than 5 nodes, yellow if between 5 and 10 nodes, and red if more than 10 nodes
Attempts:
2 left
💡 Hint
Think about shard allocation and its impact on cluster health colors.