原英文版地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/security-api-get-user.html, 原文档版权归 www.elastic.co 所有
本地英文版地址: ../en/security-api-get-user.html
本地英文版地址: ../en/security-api-get-user.html
重要: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 当前版本文档。
Get users APIedit
Retrieves information about users in the native realm and built-in users.
Prerequisitesedit
-
To use this API, you must have at least the
manage_security
cluster privilege.
Descriptionedit
For more information about the native realm, see Realms and Native user authentication.
Path parametersedit
-
username
- (Optional, string) 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.
Response bodyedit
A successful call returns an array of users with the JSON representation of the users. Note that user passwords are not included.
Response codesedit
If the user is not defined in the native
realm, the request 404s.
Examplesedit
To retrieve a native user, submit a GET request to the /_security/user/<username>
endpoint:
GET /_security/user/jacknich
{ "jacknich": { "username": "jacknich", "roles": [ "admin", "other_role1" ], "full_name": "Jack Nicholson", "email": "jacknich@example.com", "metadata": { "intelligence" : 7 }, "enabled": true } }
Omit the username to retrieve all users:
GET /_security/user