Bird
Raised Fist0

What is wrong with this Elasticsearch role definition?

medium📝 Debug Q6 of Q15
Elasticsearch - Security
What is wrong with this Elasticsearch role definition?
{"role": {"cluster": ["all"], "indices": [{"names": "logs-*", "privileges": ["read"]}]}}
AThe 'privileges' field cannot include 'read'
BThe 'names' field should be an array, not a string
CThe 'cluster' privileges cannot be 'all'
DThe role is missing a 'run_as' field
Step-by-Step Solution
Solution:
  1. Step 1: Check 'names' field format

    Elasticsearch expects 'names' to be an array of strings.
  2. Step 2: Identify the error

    Here, 'names' is a string instead of an array, causing a syntax error.
  3. Final Answer:

    The 'names' field should be an array, not a string -> Option B
  4. Quick Check:

    'names' must be an array [OK]
Quick Trick: 'names' must be an array, not a string [OK]
Common Mistakes:
MISTAKES
  • Using string instead of array for 'names'
  • Misunderstanding valid cluster privileges

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes