0
0
Elasticsearchquery~10 mins

Shard sizing strategy in Elasticsearch - Interactive Code Practice

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

Complete the code to set the number of shards to 5 in the index settings.

Elasticsearch
{
  "settings": {
    "number_of_shards": [1]
  }
}
Drag options to blanks, or click blank then click option'
A10
B1
C3
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Setting number_of_shards to 1 when more shards are needed for scaling.
Using a very high number like 10 without reason.
2fill in blank
medium

Complete the code to set the shard size limit to 50GB using the index.routing.allocation.total_shards_per_node setting.

Elasticsearch
{
  "settings": {
    "index.routing.allocation.total_shards_per_node": [1]
  }
}
Drag options to blanks, or click blank then click option'
A"5"
B"50"
C"20"
D"10"
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing shard count with shard size.
Setting the value too high causing large shards.
3fill in blank
hard

Fix the error in the shard size calculation formula to estimate shard size correctly.

Elasticsearch
shard_size_gb = total_index_size_gb [1] number_of_shards
Drag options to blanks, or click blank then click option'
A*
B+
C/
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication instead of division.
Using addition or subtraction which are incorrect here.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps each shard to its size if the size is less than 30GB.

Elasticsearch
shard_sizes = {shard: size[1] 2 for shard, size in shards.items() if size [2] 30}
Drag options to blanks, or click blank then click option'
A**
B>
C<
D//
Attempts:
3 left
💡 Hint
Common Mistakes
Using > instead of < in the condition.
Using multiplication instead of exponentiation.
5fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps uppercase shard names to their sizes if size is greater than 20GB.

Elasticsearch
filtered_shards = {shard[1]: size for shard, size in shards.items() if size [2] 20}
Drag options to blanks, or click blank then click option'
A.upper()
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using < instead of > in the condition.
Adding extra characters to size.