0
0
Elasticsearchquery~10 mins

Replica management 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 replicas to 2 for an index.

Elasticsearch
{
  "settings": {
    "number_of_replicas": [1]
  }
}
Drag options to blanks, or click blank then click option'
A0
B3
C2
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Setting replicas to 0 disables replication.
Using a string instead of a number.
2fill in blank
medium

Complete the code to update the number of replicas to 1 for an existing index named 'products'.

Elasticsearch
PUT /products/_settings
{
  "index": {
    "number_of_replicas": [1]
  }
}
Drag options to blanks, or click blank then click option'
A1
B2
C3
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to update replicas with a POST request.
Using the wrong index name.
3fill in blank
hard

Fix the error in the code to correctly set replicas to 0 for the index 'logs'.

Elasticsearch
PUT /logs/_settings
{
  "index": {
    "number_of_replicas": [1]
  }
}
Drag options to blanks, or click blank then click option'
A"0"
Bfalse
C"zero"
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around numbers.
Using boolean values instead of numbers.
4fill in blank
hard

Fill both blanks to create a settings update that sets replicas to 3 and refresh interval to 30s.

Elasticsearch
PUT /archive/_settings
{
  "number_of_replicas": [1],
  "refresh_interval": [2]
}
Drag options to blanks, or click blank then click option'
A3
B"30s"
C"30 seconds"
D30
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number without quotes for refresh interval.
Using an invalid string format for refresh interval.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps index names to their replica count if replicas are greater than 1.

Elasticsearch
replica_counts = {index[1]: settings[2] for index, settings in indices.items() if settings.get('number_of_replicas', 0) [3] 1}
Drag options to blanks, or click blank then click option'
A.upper()
B['number_of_replicas']
C>
D['replicas']
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong keys to access replica count.
Using incorrect comparison operators.