Bird
Raised Fist0

Which of the following is the correct syntax to define an alias with a filter in Elasticsearch?

easy📝 Syntax Q3 of Q15
Elasticsearch - Advanced Patterns
Which of the following is the correct syntax to define an alias with a filter in Elasticsearch?
A{"alias": {"my_alias": {"filter": {"term": {"status": "active"}}}}}
B{"aliases": {"my_alias": {"filter": {"term": {"status": "active"}}}}}
C{"aliases": {"my_alias": {"query": {"term": {"status": "active"}}}}}
D{"aliases": {"my_alias": {"filter": {"match": {"status": "active"}}}}}
Step-by-Step Solution
Solution:
  1. Step 1: Check alias syntax

    Elasticsearch uses "aliases" key with alias name and "filter" for filtered alias.
  2. Step 2: Validate filter structure

    Filter uses "term" query for exact match; "match" is for full-text search.
  3. Final Answer:

    {"aliases": {"my_alias": {"filter": {"term": {"status": "active"}}}}} -> Option B
  4. Quick Check:

    Alias with filter uses "aliases" and "term" [OK]
Quick Trick: Use "aliases" with "filter" and "term" for filtered alias [OK]
Common Mistakes:
MISTAKES
  • Using "alias" instead of "aliases" key
  • Using "query" instead of "filter"
  • Using "match" instead of "term" for exact filter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes