0
0
Elasticsearchquery~10 mins

Index aliases 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 create an alias named 'my_alias' for the index 'my_index'.

Elasticsearch
POST /_aliases
{
  "actions": [
    { "add": { "index": "my_index", "alias": "[1]" } }
  ]
}
Drag options to blanks, or click blank then click option'
Aindex_alias
Balias_index
Cdefault_alias
Dmy_alias
Attempts:
3 left
💡 Hint
Common Mistakes
Using the index name instead of the alias name.
Using a different alias name than requested.
2fill in blank
medium

Complete the code to remove the alias 'old_alias' from the index 'old_index'.

Elasticsearch
POST /_aliases
{
  "actions": [
    { "remove": { "index": "old_index", "alias": "[1]" } }
  ]
}
Drag options to blanks, or click blank then click option'
Aold_alias
Bnew_alias
Cremove_alias
Dalias_old
Attempts:
3 left
💡 Hint
Common Mistakes
Removing the wrong alias name.
Confusing index name with alias name.
3fill in blank
hard

Fix the error in the code to add alias 'search_alias' to index 'products'.

Elasticsearch
POST /_aliases
{
  "actions": [
    { "add": { "index": "[1]", "alias": "search_alias" } }
  ]
}
Drag options to blanks, or click blank then click option'
Aproduct_index
Bproduct
Cproducts
Dproduct_list
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular form instead of plural.
Using a different index name.
4fill in blank
hard

Fill both blanks to create an alias 'logs_alias' for index 'logs_2023' with a filter for 'status' equals 'error'.

Elasticsearch
POST /_aliases
{
  "actions": [
    { "add": { "index": "[1]", "alias": "[2]", "filter": { "term": { "status": "error" } } } }
  ]
}
Drag options to blanks, or click blank then click option'
Alogs_2023
Blogs_alias
Cerror_logs
Dlogs2023
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up index and alias names.
Using incorrect index or alias names.
5fill in blank
hard

Fill all three blanks to atomically remove alias 'temp_alias' from 'temp_index' and add alias 'prod_alias' to 'prod_index'.

Elasticsearch
POST /_aliases
{
  "actions": [
    { "remove": { "index": "[1]", "alias": "[2]" } },
    { "add": { "index": "[3]", "alias": "prod_alias" } }
  ]
}
Drag options to blanks, or click blank then click option'
Atemp_index
Btemp_alias
Cprod_index
Dprod_alias
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping index and alias names.
Using wrong index names for add or remove.