0
0
Elasticsearchquery~10 mins

API key management in Elasticsearch - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create an API key with a name.

Elasticsearch
POST /_security/api_key
{
  "name": "[1]"
}
Drag options to blanks, or click blank then click option'
Aapi_key
Bkey_name
Cmy-api-key
Ddefault
Attempts:
3 left
💡 Hint
Common Mistakes
Using a field name other than 'name' for the API key name.
Leaving the name empty or using invalid characters.
2fill in blank
medium

Complete the code to specify the role descriptors for the API key.

Elasticsearch
POST /_security/api_key
{
  "name": "my-api-key",
  "role_descriptors": {
    "[1]": {
      "cluster": ["all"]
    }
  }
}
Drag options to blanks, or click blank then click option'
Arole1
Buser_role
Cdefault_role
Dadmin_role
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid characters or spaces in the role name.
Omitting the role name key inside role_descriptors.
3fill in blank
hard

Fix the error in the code to delete an API key by its ID.

Elasticsearch
DELETE /_security/api_key/[1]
Drag options to blanks, or click blank then click option'
Aid
BapiKeyId
Capi_key_id
Dkey_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using camelCase, snake_case, or incorrect parameter names in the URL.
Omitting the API key ID in the delete request.
4fill in blank
hard

Fill both blanks to create an API key with limited privileges.

Elasticsearch
POST /_security/api_key
{
  "name": "limited-key",
  "role_descriptors": {
    "[1]": {
      "cluster": ["[2]"]
    }
  }
}
Drag options to blanks, or click blank then click option'
Alimited_role
Bmonitor
Cwrite
Dadmin
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'admin' privilege when limited access is intended.
Not matching the role name and privilege correctly.
5fill in blank
hard

Fill all three blanks to create an API key with a name, role, and expiration.

Elasticsearch
POST /_security/api_key
{
  "name": "[1]",
  "role_descriptors": {
    "[2]": {
      "cluster": ["all"]
    }
  },
  "expiration": "[3]"
}
Drag options to blanks, or click blank then click option'
Atemp-key
Btemp_role
C1d
Dpermanent
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid expiration formats.
Omitting the expiration field when a temporary key is needed.