0
0
Elasticsearchquery~20 mins

Index settings (shards, replicas) in Elasticsearch - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Shard and Replica Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
1:00remaining
What is the default number of primary shards for a new Elasticsearch index?
By default, when you create a new index in Elasticsearch without specifying shard settings, how many primary shards does it have?
A5
B0
C3
D1
Attempts:
2 left
💡 Hint
Think about the default shard count Elasticsearch uses for balancing data.
query_result
intermediate
1:00remaining
How many replicas are created by default for an Elasticsearch index?
When you create an index in Elasticsearch without specifying replica settings, how many replica shards are created by default?
A0
B1
C2
D5
Attempts:
2 left
💡 Hint
Replicas provide fault tolerance and improve search performance.
📝 Syntax
advanced
1:30remaining
Which JSON snippet correctly sets an index with 3 primary shards and 2 replicas?
Select the valid JSON configuration to create an Elasticsearch index with 3 primary shards and 2 replicas.
A{ "settings": { "number_of_shards": 3, "number_of_replicas": 2 } }
B{ "settings": { "shards": 3, "replicas": 2 } }
C{ "settings": { "number_of_shards": "3", "number_of_replicas": "2" } }
D{ "settings": { "primary_shards": 3, "replica_shards": 2 } }
Attempts:
2 left
💡 Hint
Look for the exact keys Elasticsearch expects for shard settings.
🧠 Conceptual
advanced
1:30remaining
Why should you avoid setting the number of primary shards too high for a small index?
What is the main reason to avoid configuring too many primary shards for a small Elasticsearch index?
AIt automatically disables replicas for the index.
BIt causes Elasticsearch to reject writes to the index.
CIt merges all shards into one, reducing parallelism.
DIt increases cluster overhead and wastes resources without improving performance.
Attempts:
2 left
💡 Hint
Think about resource use and efficiency.
🔧 Debug
expert
2:00remaining
What error occurs if you try to set number_of_shards to 0 when creating an index?
You run this command to create an index with zero primary shards: { "settings": { "number_of_shards": 0, "number_of_replicas": 1 } } What error will Elasticsearch return?
ANo error, index created with zero shards
BIndexCreationException: replicas cannot be set without shards
CValidationException: number_of_shards must be greater than 0
DClusterBlockException: cluster is blocked due to invalid shard count
Attempts:
2 left
💡 Hint
Primary shards must be at least one for an index to exist.