Check user privileges
- POST also GET /_security/user/{user}/_has_privileges
- POST also GET /_security/user/_has_privileges
Determine whether the specified user has a specified list of privileges. All users can use this API, but only to determine their own privileges. To check the privileges of other users, you must use the run as feature.
About Elasticsearch privilegesPath Parameters
-
userstring Nameoptional -
Username
Leave it out to use
/_security/user/_has_privileges.
Request
-
applicationApplicationPrivilegesCheck -
applicationstringrequired -
The name of the application.
-
privilegesstringrequired -
A list of the privileges that you want to check for the specified resources. It may be either application privilege names or the names of actions that are granted by those privileges
-
resourcesstringrequired -
A list of resource names against which the privileges should be checked.
-
clusterClusterPrivilege -
A list of the cluster privileges that you want to check.
-
Values:
allcancel_taskmanagemanage_api_keymanage_behavioral_analyticsmanage_enrichmanage_esqlmanage_index_templatesmanage_inferencemanage_ingest_pipelinesmanage_logstash_pipelinesmanage_mlmanage_own_api_keymanage_pipelinemanage_reindexmanage_search_applicationmanage_search_query_rulesmanage_search_synonymsmanage_securitymanage_transformmonitormonitor_enrichmonitor_esqlmonitor_inferencemonitor_mlmonitor_reindexmonitor_transformnonepost_behavioral_analytics_eventread_pipelineread_securityread_project_routingmanage_project_routing -
indexIndexPrivilegesCheck -
namesstring Indicesrequired -
A list of indices.
-
privilegesIndexPrivilegerequired -
A list of the privileges that you want to check for the specified indices.
-
Values:
allauto_configurecreatecreate_doccreate_indexcreate_viewdeletedelete_indexdelete_viewindexmaintenancemanagemanage_data_stream_lifecyclemanage_viewmonitornonereadread_view_metadataview_index_metadatawrite -
allow_restricted_indicesboolean -
This needs to be set to
true(default isfalse) if using wildcards or regexps for patterns that cover restricted indices. Implicitly, restricted indices do not match index patterns because restricted indices usually have limited privileges and including them in pattern tests would render most such tests false. If restricted indices are explicitly included in the names list, privileges will be checked against them regardless of the value ofallow_restricted_indices.
Response
-
applicationApplicationsPrivilegesrequired -
clustermap string to booleanrequired -
has_all_requestedbooleanrequired -
indexmap string to Privilegesrequired -
usernamestringrequired