All methods and paths for this operation:
To use this API, you must have one of the following privileges:
manage_security cluster privilege (or a greater privilege such as all).Application names are formed from a prefix, with an optional suffix that conform to the following rules:
- or _.\, /, *, ?, ", <, >, |, ,, *.Privilege names must begin with a lowercase ASCII letter and must contain only ASCII letters and digits along with the characters _, -, and ..
Action names can contain any number of printable ASCII characters and must contain at least one of the following characters: /, *, :.
manage_securityIf true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.
Values are true, false, or wait_for.
PUT /_security/privilege
{
"myapp": {
"read": {
"actions": [
"data:read/*" ,
"action:login" ],
"metadata": {
"description": "Read access to myapp"
}
}
}
}
resp = client.security.put_privileges(
privileges={
"myapp": {
"read": {
"actions": [
"data:read/*",
"action:login"
],
"metadata": {
"description": "Read access to myapp"
}
}
}
},
)
const response = await client.security.putPrivileges({
privileges: {
myapp: {
read: {
actions: ["data:read/*", "action:login"],
metadata: {
description: "Read access to myapp",
},
},
},
},
});
response = client.security.put_privileges(
body: {
"myapp": {
"read": {
"actions": [
"data:read/*",
"action:login"
],
"metadata": {
"description": "Read access to myapp"
}
}
}
}
)
$resp = $client->security()->putPrivileges([
"body" => [
"myapp" => [
"read" => [
"actions" => array(
"data:read/*",
"action:login",
),
"metadata" => [
"description" => "Read access to myapp",
],
],
],
],
]);
curl -X PUT -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"myapp":{"read":{"actions":["data:read/*","action:login"],"metadata":{"description":"Read access to myapp"}}}}' "$ELASTICSEARCH_URL/_security/privilege"
{
"myapp": {
"read": {
"actions": [
"data:read/*" ,
"action:login" ],
"metadata": {
"description": "Read access to myapp"
}
}
}
}
{
"app01": {
"read": {
"actions": [ "action:login", "data:read/*" ]
},
"write": {
"actions": [ "action:login", "data:write/*" ]
}
},
"app02": {
"all": {
"actions": [ "*" ]
}
}
}
{
"myapp": {
"read": {
"created": true
}
}
}
{
"app02": {
"all": {
"created": true
}
},
"app01": {
"read": {
"created": true
},
"write": {
"created": true
}
}
}