Get roles Generally available
All methods and paths for this operation:
GET /_security/role
GET /_security/role/{name}
Get 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 get roles API cannot retrieve roles that are defined in roles files.
Required authorization
- Cluster privileges:
read_security
GET /_security/role/{name}
Console
GET /_security/role/my_admin_role
resp = client.security.get_role( name="my_admin_role", )
const response = await client.security.getRole({ name: "my_admin_role", });
response = client.security.get_role( name: "my_admin_role" )
$resp = $client->security()->getRole([ "name" => "my_admin_role", ]);
curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/role/my_admin_role"
client.security().getRole(g -> g .name("my_admin_role") );
Response examples (200)
A successful response from `GET /_security/role/my_admin_role`. The response contains information about the `my_admin_role` role in the native realm.
{ "my_admin_role": { "description": "Grants full access to all management features within the cluster.", "cluster" : [ "all" ], "indices" : [ { "names" : [ "index1", "index2" ], "privileges" : [ "all" ], "allow_restricted_indices" : false, "field_security" : { "grant" : [ "title", "body" ]} } ], "applications" : [ ], "run_as" : [ "other_user" ], "metadata" : { "version" : 1 }, "transient_metadata": { "enabled": true } } }