[[reference-security-put_role]] //////// =========================================================================================================================== || || || || || || || ██████╗ ███████╗ █████╗ ██████╗ ███╗ ███╗███████╗ || || ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝ || || ██████╔╝█████╗ ███████║██║ ██║██╔████╔██║█████╗ || || ██╔══██╗██╔══╝ ██╔══██║██║ ██║██║╚██╔╝██║██╔══╝ || || ██║ ██║███████╗██║ ██║██████╔╝██║ ╚═╝ ██║███████╗ || || ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝ || || || || || || This file is autogenerated, DO NOT send pull requests that changes this file directly. || || You should update the script that does the generation, which can be found in: || || https://github.com/elastic/elastic-client-generator-js || || || || You can run the script with the following command: || || npm run elasticsearch -- --version || || || || || || || =========================================================================================================================== //////// [discrete] === client.security.putRole Create or update roles. The role management APIs are generally the preferred way to manage roles in the native realm, rather than using file-based role management. The create or update roles API cannot update roles that are defined in roles files. File-based role management is not available in Elastic Serverless. {ref}/security-api-put-role.html[{es} documentation] [discrete] ==== Function signature [source,ts] ---- (SecurityPutRoleRequest, options?): Promise ---- [discrete] ===== `SecurityPutRoleRequest` [source,ts] ---- interface SecurityPutRoleRequest extends <> { name: <> refresh?: <> applications?: SecurityApplicationPrivileges[] cluster?: SecurityClusterPrivilege[] global?: Record indices?: SecurityIndicesPrivileges[] remote_indices?: SecurityRemoteIndicesPrivileges[] metadata?: <> run_as?: string[] description?: string transient_metadata?: Record } ---- [discrete] ===== `SecurityPutRoleResponse` [source,ts] ---- interface SecurityPutRoleResponse { role: SecurityCreatedStatus } ----