Find roles with a query Added in 8.15.0
Get roles in a paginated manner. The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The query roles API does not retrieve roles that are defined in roles files, nor built-in ones. You can optionally filter the results with a query. Also, the results can be paginated and sorted.
Body
-
query object
Additional properties are allowed.
-
from number
The starting document offset. It must not be negative. By default, you cannot page through more than 10,000 hits using the
from
andsize
parameters. To page through more hits, use thesearch_after
parameter. -
size number
The number of hits to return. It must not be negative. By default, you cannot page through more than 10,000 hits using the
from
andsize
parameters. To page through more hits, use thesearch_after
parameter. -
search_after array[number | string | boolean | null]
A field value.
curl \
--request POST http://api.example.com/_security/_query/role \
--header "Content-Type: application/json" \
--data '{"query":{"match":{},"prefix":{},"range":{},"term":{},"wildcard":{}},"from":42.0,"":"string","size":42.0,"search_after":[42.0]}'
{
"query": {
"match": {},
"prefix": {},
"range": {},
"term": {},
"wildcard": {}
},
"from": 42.0,
"": "string",
"size": 42.0,
"search_after": [
42.0
]
}
{
"total": 42.0,
"count": 42.0,
"roles": [
{
"cluster": [
"string"
],
"indices": [
{
"field_security": {},
"privileges": [
"string"
],
"allow_restricted_indices": true
}
],
"remote_indices": [
{
"clusters": "string",
"field_security": {},
"privileges": [
"string"
],
"allow_restricted_indices": true
}
],
"remote_cluster": [
{
"clusters": "string",
"privileges": [
"monitor_enrich"
]
}
],
"global": [
{}
],
"applications": [
{
"application": "string",
"privileges": [
"string"
],
"resources": [
"string"
]
}
],
"metadata": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"run_as": [
"string"
],
"description": "string",
"restriction": {
"workflows": [
"string"
]
},
"transient_metadata": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"_sort": [
42.0
],
"name": "string"
}
]
}