Bird
Raised Fist0

Given this role definition snippet:

medium📝 query result Q13 of Q15
Elasticsearch - Security
Given this role definition snippet:
{
  "indices": [
    {
      "names": ["books"],
      "privileges": ["read"],
      "query": { "term": { "genre": "fiction" } },
      "field_security": { "grant": ["title", "author"] }
    }
  ]
}

What documents and fields will a user with this role see when querying the books index?
AAll documents showing all fields
BAll documents showing only 'title' and 'author' fields
COnly documents where genre is 'fiction' showing all fields
DOnly documents where genre is 'fiction' showing only 'title' and 'author' fields
Step-by-Step Solution
Solution:
  1. Step 1: Analyze document-level security query

    The "query" limits documents to those with genre 'fiction'.
  2. Step 2: Analyze field-level security grant

    Only "title" and "author" fields are visible due to "field_security".
  3. Final Answer:

    Only documents where genre is 'fiction' showing only 'title' and 'author' fields -> Option D
  4. Quick Check:

    Query filters docs + grant limits fields = Only documents where genre is 'fiction' showing only 'title' and 'author' fields [OK]
Quick Trick: Query filters docs; field_security limits fields shown [OK]
Common Mistakes:
MISTAKES
  • Ignoring the query filter on documents
  • Assuming all fields are visible
  • Confusing document and field level restrictions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes