Bulk create or update roles Added in 8.15.0
The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The bulk create or update roles API cannot update roles that are defined in roles files.
Query parameters
-
refresh string
If
true
(the default) then refresh the affected shards to make this operation visible to search, ifwait_for
then wait for a refresh to make this operation visible to search, iffalse
then do nothing with refreshes.Values are
true
,false
, orwait_for
.
POST
/_security/role
curl \
-X POST http://api.example.com/_security/role \
-H "Content-Type: application/json" \
-d '{"roles":{"additionalProperty1":{"cluster":["string"],"indices":[{"field_security":{"except":"string","grant":"string"},"names":"string","privileges":["string"],"":"string","allow_restricted_indices":true}],"remote_indices":[{"clusters":"string","field_security":{"except":"string","grant":"string"},"names":"string","privileges":["string"],"":"string","allow_restricted_indices":true}],"remote_cluster":[{"clusters":"string","privileges":["monitor_enrich"]}],"global":[{"application":{"manage":{}}}],"applications":[{"application":"string","privileges":["string"],"resources":["string"]}],"metadata":{"additionalProperty1":{},"additionalProperty2":{}},"run_as":["string"],"description":"string","restriction":{"workflows":["string"]},"transient_metadata":{"additionalProperty1":{},"additionalProperty2":{}}},"additionalProperty2":{"cluster":["string"],"indices":[{"field_security":{"except":"string","grant":"string"},"names":"string","privileges":["string"],"":"string","allow_restricted_indices":true}],"remote_indices":[{"clusters":"string","field_security":{"except":"string","grant":"string"},"names":"string","privileges":["string"],"":"string","allow_restricted_indices":true}],"remote_cluster":[{"clusters":"string","privileges":["monitor_enrich"]}],"global":[{"application":{"manage":{}}}],"applications":[{"application":"string","privileges":["string"],"resources":["string"]}],"metadata":{"additionalProperty1":{},"additionalProperty2":{}},"run_as":["string"],"description":"string","restriction":{"workflows":["string"]},"transient_metadata":{"additionalProperty1":{},"additionalProperty2":{}}}}}'
Request examples
{
"roles": {
"additionalProperty1": {
"cluster": [
"string"
],
"indices": [
{
"field_security": {
"except": "string",
"grant": "string"
},
"names": "string",
"privileges": [
"string"
],
"": "string",
"allow_restricted_indices": true
}
],
"remote_indices": [
{
"clusters": "string",
"field_security": {
"except": "string",
"grant": "string"
},
"names": "string",
"privileges": [
"string"
],
"": "string",
"allow_restricted_indices": true
}
],
"remote_cluster": [
{
"clusters": "string",
"privileges": [
"monitor_enrich"
]
}
],
"global": [
{
"application": {
"manage": {}
}
}
],
"applications": [
{
"application": "string",
"privileges": [
"string"
],
"resources": [
"string"
]
}
],
"metadata": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"run_as": [
"string"
],
"description": "string",
"restriction": {
"workflows": [
"string"
]
},
"transient_metadata": {
"additionalProperty1": {},
"additionalProperty2": {}
}
},
"additionalProperty2": {
"cluster": [
"string"
],
"indices": [
{
"field_security": {
"except": "string",
"grant": "string"
},
"names": "string",
"privileges": [
"string"
],
"": "string",
"allow_restricted_indices": true
}
],
"remote_indices": [
{
"clusters": "string",
"field_security": {
"except": "string",
"grant": "string"
},
"names": "string",
"privileges": [
"string"
],
"": "string",
"allow_restricted_indices": true
}
],
"remote_cluster": [
{
"clusters": "string",
"privileges": [
"monitor_enrich"
]
}
],
"global": [
{
"application": {
"manage": {}
}
}
],
"applications": [
{
"application": "string",
"privileges": [
"string"
],
"resources": [
"string"
]
}
],
"metadata": {
"additionalProperty1": {},
"additionalProperty2": {}
},
"run_as": [
"string"
],
"description": "string",
"restriction": {
"workflows": [
"string"
]
},
"transient_metadata": {
"additionalProperty1": {},
"additionalProperty2": {}
}
}
}
}
Response examples (200)
{
"created": [
"string"
],
"updated": [
"string"
],
"noop": [
"string"
],
"errors": {
"count": 42.0,
"details": {
"*": {
"type": "string",
"reason": "string",
"stack_trace": "string",
"caused_by": {},
"root_cause": [
{}
],
"suppressed": [
{}
]
}
}
}
}