0
0
Elasticsearchquery~10 mins

Why cluster health ensures reliability in Elasticsearch - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to check the cluster health status.

Elasticsearch
GET /_cluster/health?wait_for_status=[1]
Drag options to blanks, or click blank then click option'
A"green"
B"blue"
C"red"
D"yellow"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'red' or 'yellow' which indicate problems in the cluster.
2fill in blank
medium

Complete the code to retrieve the number of active primary shards.

Elasticsearch
GET /_cluster/health?filter_path=[1]
Drag options to blanks, or click blank then click option'
A"number_of_nodes"
B"status"
C"active_primary_shards"
D"relocating_shards"
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing with status or number_of_nodes fields.
3fill in blank
hard

Fix the error in the code to wait for the cluster to be at least yellow.

Elasticsearch
GET /_cluster/health?wait_for_status=[1]
Drag options to blanks, or click blank then click option'
A"green"
B"yellow"
C"red"
D"blue"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'red' which means cluster is unhealthy.
4fill in blank
hard

Fill both blanks to filter the cluster health response to only show status and number of nodes.

Elasticsearch
GET /_cluster/health?filter_path=[1],[2]
Drag options to blanks, or click blank then click option'
A"status"
B"number_of_nodes"
C"active_shards"
D"relocating_shards"
Attempts:
3 left
💡 Hint
Common Mistakes
Including shard counts which are not asked for.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps node names to their roles if the cluster status is green.

Elasticsearch
nodes_roles = {node['name']: node['roles'] for node in cluster['nodes'] if cluster['status'] == [1] and 'data' [2] node['roles'] and 'master' [3] node['roles']}
Drag options to blanks, or click blank then click option'
A"green"
Bin
Cnot in
D"yellow"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'not in' which excludes nodes with those roles.