0
0
Elasticsearchquery~20 mins

Replica management in Elasticsearch - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Replica Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this Elasticsearch replica setting query?
Given the following request to update the number of replicas for an index, what will be the number of replicas after the update?
Elasticsearch
PUT /my-index/_settings
{
  "index" : {
    "number_of_replicas" : 2
  }
}
AThe request will fail with a syntax error.
BThe index will have 0 replicas per shard.
CThe index will have 1 replica per shard.
DThe index will have 2 replicas per shard.
Attempts:
2 left
💡 Hint
The number_of_replicas setting controls how many copies of each shard exist besides the primary.
Predict Output
intermediate
2:00remaining
What happens if you set number_of_replicas to 0?
Consider this request to update an index's replica count: PUT /logs/_settings { "index": { "number_of_replicas": 0 } } What is the effect on the index?
Elasticsearch
PUT /logs/_settings
{
  "index": {
    "number_of_replicas": 0
  }
}
AThe request will cause an error because replicas cannot be zero.
BThe index will have one replica shard per primary shard.
CThe index will have no replica shards, only primary shards.
DThe index will have two replica shards per primary shard.
Attempts:
2 left
💡 Hint
Replicas provide copies of data for fault tolerance. Zero means no copies.
Predict Output
advanced
2:00remaining
What error does this replica setting update cause?
What error will this request produce? PUT /data/_settings { "index": { "number_of_replicas": -1 } }
Elasticsearch
PUT /data/_settings
{
  "index": {
    "number_of_replicas": -1
  }
}
A400 Bad Request: number_of_replicas must be >= 0
B200 OK: number_of_replicas set to -1
C500 Internal Server Error
D404 Not Found: index does not exist
Attempts:
2 left
💡 Hint
Replica count cannot be negative.
🧠 Conceptual
advanced
2:00remaining
How does replica count affect search availability during node failure?
If an Elasticsearch cluster has 1 replica per shard and one data node fails, what happens to search availability for the shards on that node?
ASearch fails because primary shards are lost and replicas are not used.
BSearch continues without interruption because replicas serve the requests.
CSearch is slower but still works because replicas are rebuilt from scratch.
DSearch stops until the failed node is back online.
Attempts:
2 left
💡 Hint
Replicas provide copies that can serve search requests if primaries fail.
Predict Output
expert
3:00remaining
What is the number of shards and replicas after this index creation?
Given this index creation request, how many total shards (primary + replicas) will the index have? PUT /analytics { "settings": { "number_of_shards": 3, "number_of_replicas": 2 } }
Elasticsearch
PUT /analytics
{
  "settings": {
    "number_of_shards": 3,
    "number_of_replicas": 2
  }
}
A9 total shards: 3 primary + 6 replicas
B6 total shards: 3 primary + 3 replicas
C3 total shards: 3 primary only
D5 total shards: 3 primary + 2 replicas
Attempts:
2 left
💡 Hint
Total shards = primary shards + (primary shards × number_of_replicas).