Adds or updates application privileges.
This API creates or updates privileges. To remove privileges, use the delete application privilege API.
For more information, see Application privileges.
To check a user’s application privileges, use the has privileges API.
The body is a JSON object where the names of the fields are the application names and the value of each field is an object. The fields in this inner object are the names of the privileges and each value is a JSON object that includes the following fields:
actions
metadata
metadata
object, keys
that begin with _
are reserved for system usage.
Application names are formed from a prefix, with an optional suffix that conform to the following rules:
-
or _
\\
, /
, *
, ?
, "
, <
, >
, |
, ,
, *
_
, -
and .
/
*
, :
To use this API, you must have either:
manage_security
cluster privilege (or a greater privilege such as all
); or
To add a single privilege, submit a PUT or POST request to the
/_security/privilege/<application>/<privilege>
endpoint. For example:
PUT /_security/privilege { "myapp": { "read": { "actions": [ "data:read/*" , "action:login" ], "metadata": { "description": "Read access to myapp" } } } }
These strings have significance within the "myapp" application. Elasticsearch does not assign any meaning to them. | |
The use of a wildcard here ( | |
The metadata object is optional. |
A successful call returns a JSON structure that shows whether the privilege has been created or updated.
To add multiple privileges, submit a POST request to the
/_security/privilege/
endpoint. For example:
PUT /_security/privilege { "app01": { "read": { "actions": [ "action:login", "data:read/*" ] }, "write": { "actions": [ "action:login", "data:write/*" ] } }, "app02": { "all": { "actions": [ "*" ] } } }
A successful call returns a JSON structure that shows whether the privileges have been created or updated.
{ "app02": { "all": { "created": true } }, "app01": { "read": { "created": true }, "write": { "created": true } } }