Bird
0
0

Which of the following is the correct syntax to add an alias named logs_current to an index called logs_2024 using Elasticsearch API?

easy📝 Syntax Q12 of 15
Elasticsearch - Index Management

Which of the following is the correct syntax to add an alias named logs_current to an index called logs_2024 using Elasticsearch API?

{
  "actions": [
    {
      "add": {
        "index": "logs_2024",
        "alias": "logs_current"
      }
    }
  ]
}
APUT /logs_current { "index": "logs_2024" }
BPOST /_aliases { "actions": [{ "add": { "index": "logs_2024", "alias": "logs_current" } }] }
CGET /logs_2024/_alias/logs_current
DDELETE /_aliases { "actions": [{ "remove": { "index": "logs_2024", "alias": "logs_current" } }] }
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct API endpoint and method

    Adding an alias uses POST on /_aliases with an actions array.
  2. Step 2: Match the syntax with the options

    POST /_aliases { "actions": [{ "add": { "index": "logs_2024", "alias": "logs_current" } }] } correctly uses POST /_aliases with the add action and proper JSON structure.
  3. Final Answer:

    POST /_aliases with add action JSON -> Option B
  4. Quick Check:

    Adding alias uses POST /_aliases = A [OK]
Quick Trick: Add aliases with POST /_aliases and actions array [OK]
Common Mistakes:
MISTAKES
  • Using PUT on alias name instead of POST on /_aliases
  • Using GET to add an alias (GET is for reading)
  • Confusing remove action with add

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes