API key management helps you control who can access your Elasticsearch data safely. It lets you create, use, and delete keys that act like secret passwords for apps.
When you want to let an app read or write data without sharing your main password.
When you need to give limited access to a service for a short time.
When you want to track which app or user is using your Elasticsearch.
When you want to easily revoke access without changing your main credentials.
The "name" field in the request body sets the API key's name.
Step 2: Read the value of the "name" field
The value is "my-app-key", which becomes the API key's name.
Final Answer:
my-app-key -> Option A
Quick Check:
API key name = "name" field value [OK]
Hint: API key name is in the "name" field [OK]
Common Mistakes:
Confusing role name with API key name
Using index pattern as key name
Mistaking privileges for name
4. You try to delete an API key using this request: DELETE /_security/api_key?id=12345 but get an error. What is the likely cause?
medium
A. API key names cannot be deleted, only IDs
B. API key ID must be passed in the request body, not as a query parameter
C. DELETE method is not supported for API keys
D. You must use GET method to delete API keys
Solution
Step 1: Check API key deletion syntax
Elasticsearch requires the API key ID in the request body JSON, not as a URL query parameter.
Step 2: Understand method support
DELETE method is supported, but parameters must be correctly passed in the body.
Final Answer:
API key ID must be passed in the request body, not as a query parameter -> Option B
Quick Check:
Delete API key ID in body, not URL [OK]
Hint: Pass API key ID in JSON body for deletion [OK]
Common Mistakes:
Passing ID as URL query parameter
Using wrong HTTP method
Confusing API key name with ID
5. You want to create an API key that only allows reading from indices starting with "sales-" and no cluster privileges. Which role descriptor is correct in the request body?