Delete roles
Generally available
Delete roles in the native realm. The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The delete roles API cannot remove roles that are defined in roles files.
highlight#highlightFromAnchor" href="#topic-required-authorization"> Required authorization
- Cluster privileges:
manage_security
DELETE
/_security/role/{name}
dropdown#toggle click@window->dropdown#hide touchend@window->dropdown#hide"
data-dropdown-target="button"
data-scrollable="false"
data-headings="false"
aria-expanded="false"
aria-haspopup="true"
role="menu"
tabindex="0">
Console
DELETE /_security/role/my_admin_role
resp = client.security.delete_role(
name="my_admin_role",
)
const response = await client.security.deleteRole({
name: "my_admin_role",
});
response = client.security.delete_role(
name: "my_admin_role"
)
$resp = $client->security()->deleteRole([
"name" => "my_admin_role",
]);
curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/role/my_admin_role"
client.security().deleteRole(d -> d
.name("my_admin_role")
);
Response examples (200)
A successful response from `DELETE /_security/role/my_admin_role`. If the role is successfully deleted, `found` is set to `true`.
{
"found" : true
}