Get users Generally available

GET /_security/user/{username}

Get information about users in the native realm and built-in users.

Required authorization

  • Cluster privileges: read_security

Path parameters

  • username string | array[string] Required

    An identifier for the user. You can specify multiple usernames as a comma-separated list. If you omit this parameter, the API retrieves information about all users.

Query parameters

  • Determines whether to retrieve the user profile UID, if it exists, for the users.

Responses

GET /_security/user/{username}
GET /_security/user/jacknich?with_profile_uid=true
resp = client.security.get_user(
    username="jacknich",
    with_profile_uid=True,
)
const response = await client.security.getUser({
  username: "jacknich",
  with_profile_uid: "true",
});
response = client.security.get_user(
  username: "jacknich",
  with_profile_uid: "true"
)
$resp = $client->security()->getUser([
    "username" => "jacknich",
    "with_profile_uid" => "true",
]);
curl -X GET -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/user/jacknich?with_profile_uid=true"
Response examples (200)
A successful response from `GET /_security/user/jacknich?with_profile_uid=true`. It includes the user `profile_uid` as part of the response.
{
  "jacknich": {
    "username": "jacknich",
    "roles": [
      "admin", "other_role1"
    ],
    "full_name": "Jack Nicholson",
    "email": "jacknich@example.com",
    "metadata": { "intelligence" : 7 },
    "enabled": true,
    "profile_uid": "u_79HkWkwmnBH5gqFKwoxggWPjEBOur1zLPXQPEl1VBW0_0"
  }
}