Delete a service account from a namespace of your own.
Deleting an account that still has service tokens is rejected unless force is true.
A forced delete leaves the tokens behind: they cannot authenticate while no account of that name exists, and recreating the account is rejected until they are deleted.
NOTE: The elastic namespace is reserved for the built-in service accounts that ship with Elasticsearch.
A name that no user-managed service account could have is rejected rather than reported as not found.
The manage_service_account privilege does not authorize this API.
Required authorization
- Cluster privileges:
manage_security
Path parameters
-
The namespace, which is a top-level grouping of service accounts. It must start with a letter or digit and can contain only letters, digits, hyphens, and underscores, up to a maximum of 128 characters. It cannot be
elastic, which is reserved for built-in service accounts. -
The service name. It must start with a letter or digit and can contain only letters, digits, hyphens, and underscores, up to a maximum of 128 characters.
Query parameters
-
If
wait_for(the default) then wait for a refresh to make this operation visible to search, iftruethen refresh the affected shards to make this operation visible to search, iffalsethen do nothing with refreshes.Default value is
wait_for. -
If
false(the default), deleting a service account that still has service tokens is rejected. Iftrue, the account is deleted and its tokens are left in place.Default value is
false.
DELETE /_security/service/my-namespace/my-service
resp = client.security.delete_user_managed_service_account(
namespace="my-namespace",
service="my-service",
)
const response = await client.security.deleteUserManagedServiceAccount({
namespace: "my-namespace",
service: "my-service",
});
response = client.security.delete_user_managed_service_account(
namespace: "my-namespace",
service: "my-service"
)
$resp = $client->security()->deleteUserManagedServiceAccount([
"namespace" => "my-namespace",
"service" => "my-service",
]);
curl -X DELETE -H "Authorization: ApiKey $ELASTIC_API_KEY" "$ELASTICSEARCH_URL/_security/service/my-namespace/my-service"
{
"found": true
}