0
0
Elasticsearchquery~10 mins

Rolling upgrades 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 start a rolling upgrade by setting the cluster to read-only mode.

Elasticsearch
PUT /_cluster/settings
{
  "persistent": {
    "cluster.blocks.read_only": [1]
  }
}
Drag options to blanks, or click blank then click option'
Afalse
Btrue
C"true"
D"false"
Attempts:
3 left
💡 Hint
Common Mistakes
Using string values like "true" instead of boolean true.
Setting the value to false which disables read-only mode.
2fill in blank
medium

Complete the code to update the index settings to disable replicas during the rolling upgrade.

Elasticsearch
PUT /my-index/_settings
{
  "index": {
    "number_of_replicas": [1]
  }
}
Drag options to blanks, or click blank then click option'
A0
B"1"
C"0"
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using string values like "0" instead of numeric 0.
Setting replicas to 1 which keeps replicas enabled.
3fill in blank
hard

Fix the error in the code to check the cluster health status during the rolling upgrade.

Elasticsearch
GET /_cluster/health
{
  "wait_for_status": [1]
}
Drag options to blanks, or click blank then click option'
A"yellow"
Bgreen
C"green"
Dyellow
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted status values causing syntax errors.
Using the wrong status string.
4fill in blank
hard

Fill both blanks to update the cluster settings to disable shard allocation and then re-enable it after the upgrade.

Elasticsearch
PUT /_cluster/settings
{
  "transient": {
    "cluster.routing.allocation.enable": [1]
  }
}

PUT /_cluster/settings
{
  "transient": {
    "cluster.routing.allocation.enable": [2]
  }
}
Drag options to blanks, or click blank then click option'
A"none"
B"all"
C"primaries"
D"new_primaries"
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect allocation values like "primaries" or "new_primaries".
Forgetting to use quotes around the values.
5fill in blank
hard

Fill all three blanks to create a script that disables shard allocation, waits for green status, and then re-enables allocation.

Elasticsearch
PUT /_cluster/settings
{
  "transient": {
    "cluster.routing.allocation.enable": [1]
  }
}

GET /_cluster/health
{
  "wait_for_status": [2],
  "timeout": "30s"
}

PUT /_cluster/settings
{
  "transient": {
    "cluster.routing.allocation.enable": [3]
  }
}
Drag options to blanks, or click blank then click option'
A"none"
B"green"
C"all"
D"yellow"
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong status values like "yellow" instead of "green".
Not using quotes around string values.
Mixing up the order of disabling and enabling allocation.