Bird
Raised Fist0

How would you define a role in Elasticsearch that grants read access to all indices except those prefixed with secret-?

hard🚀 Application Q8 of Q15
Elasticsearch - Security
How would you define a role in Elasticsearch that grants read access to all indices except those prefixed with secret-?
A{ "indices": [{ "names": ["*", "-secret-*"] , "privileges": ["read"] }] }
B{ "indices": [{ "names": ["*"], "privileges": ["read"] }], "except": ["secret-*"] }
C{ "indices": [{ "names": ["*"], "privileges": ["read"], "allow_restricted_indices": false, "except": ["secret-*"] }] }
D{ "indices": [{ "names": ["*"], "privileges": ["read"] }], "exclude": ["secret-*"] }
Step-by-Step Solution
Solution:
  1. Step 1: Understand Index Patterns

    Elasticsearch supports negative patterns by prefixing with a minus sign to exclude indices.
  2. Step 2: Apply Exclusion

    Using "names": ["*", "-secret-*"] grants access to all indices except those starting with 'secret-'.
  3. Step 3: Verify JSON Syntax

    { "indices": [{ "names": ["*", "-secret-*"] , "privileges": ["read"] }] } correctly uses an array with inclusion and exclusion patterns.
  4. Final Answer:

    { "indices": [{ "names": ["*", "-secret-*"] , "privileges": ["read"] }] } -> Option A
  5. Quick Check:

    Use negative patterns with '-' to exclude indices [OK]
Quick Trick: Exclude indices using '-' prefix in names array [OK]
Common Mistakes:
MISTAKES
  • Using unsupported 'except' or 'exclude' fields
  • Not using negative pattern syntax
  • Misplacing exclusion outside 'indices' array

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes