Bulk delete roles Added in 8.15.0

DELETE /_security/role

The role management APIs are generally the preferred way to manage roles, rather than using file-based role management. The bulk delete roles API cannot delete roles that are defined in roles files.

Query parameters

  • refresh string

    If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

    Values are true, false, or wait_for.

application/json

Body Required

  • names array[string] Required

    An array of role names to delete

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
    • deleted array[string]

      Array of deleted roles

    • not_found array[string]

      Array of roles that could not be found

    • errors object

      Additional properties are allowed.

      Hide errors attributes Show errors attributes object
      • count number Required

        The number of errors

      • details object Required

        Details about the errors, keyed by role name

        Hide details attribute Show details attribute object
        • * object

          Additional properties are allowed.

          Hide * attributes Show * attributes object
          • type string Required

            The type of error

          • reason string

            A human-readable explanation of the error, in english

          • The server stack trace. Present only if the error_trace=true parameter was sent with the request.

          • Additional properties are allowed.

          • root_cause array[object]

            Additional properties are allowed.

          • suppressed array[object]

            Additional properties are allowed.

DELETE /_security/role
curl \
 -X DELETE http://api.example.com/_security/role \
 -H "Content-Type: application/json" \
 -d '{"names":["string"]}'
Request examples
{
  "names": [
    "string"
  ]
}
Response examples (200)
{
  "deleted": [
    "string"
  ],
  "not_found": [
    "string"
  ],
  "errors": {
    "count": 42.0,
    "details": {
      "*": {
        "type": "string",
        "reason": "string",
        "stack_trace": "string",
        "caused_by": {},
        "root_cause": [
          {}
        ],
        "suppressed": [
          {}
        ]
      }
    }
  }
}