Type to search.

Granting privileges for data streams and aliases

Stack

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

Elasticsearch security features allow you to secure operations executed against data streams and aliases.

Use index privileges to control access to a data stream. Granting privileges on a data stream grants the same privileges on its backing indices.

For example, my-data-stream consists of two backing indices: .ds-my-data-stream-2099.03.07-000001 and .ds-my-data-stream-2099.03.08-000002.

A user is granted the read privilege to my-data-stream.

JavaScript
{
  "names" : [ "my-data-stream" ],
  "privileges" : [ "read" ]
}

Because the user is automatically granted the same privileges to the stream’s backing indices, the user can retrieve a document directly from .ds-my-data-stream-2099.03.08-000002:

JSON
GET .ds-my-data-stream-2099.03.08-000002/_doc/2

Later my-data-stream rolls over. This creates a new backing index: .ds-my-data-stream-2099.03.09-000003. Because the user still has the read privilege for my-data-stream, the user can retrieve documents directly from .ds-my-data-stream-2099.03.09-000003:

JSON
GET .ds-my-data-stream-2099.03.09-000003/_doc/2

Use index privileges to control access to an alias. Privileges on an index or data stream do not grant privileges on its aliases. For information about managing aliases, see Aliases.

Important

Don’t use filtered aliases in place of document level security. Elasticsearch doesn’t always apply alias filters.

For example, the current_year alias points only to the 2015 index. A user is granted the read privilege for the 2015 index.

JavaScript
{
  "names" : [ "2015" ],
  "privileges" : [ "read" ]
}

When the user attempts to retrieve a document from the current_year alias, Elasticsearch rejects the request.

JSON
GET current_year/_doc/1

To retrieve documents from current_year, the user must have the read index privilege for the alias.

JavaScript
{
  "names" : [ "current_year" ],
  "privileges" : [ "read" ]
}