---
type: api
title: Get security stats
description: Gather security usage statistics from all node(s) within the cluster.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-security-get-stats
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/operation/operation-security-get-stats
products:
  - Elasticsearch
---

# Get security stats

Availability: 9.2+

## Paths

- `GET` `/_security/stats`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/authentication#bearerauth)

## Description

Gather security usage statistics from all node(s) within the cluster.

## Required authorization

* Cluster privileges: `monitor`

## Response

`application/json`

- `nodes` (map string to NodeSecurityStats)
  A map of node IDs to security statistics for that node.
  Map values ({} NodeSecurityStats)
  - `roles` ({} RolesStats)
    Role statistics.
    - `dls` ({} SecurityRolesDls)
      Document-level security (DLS) statistics.
      - `bit_set_cache` ({} SecurityRolesDlsBitSetCache)
        - `count` (number)
          Number of entries in the cache.
        - `memory` (number | string ByteSize)
          Human-readable amount of memory taken up by the cache.
        - `memory_in_bytes` (number ulong)
          Memory taken up by the cache in bytes.
        - `hits` (number)
          Total number of cache hits.
        - `misses` (number)
          Total number of cache misses.
        - `evictions` (number)
          Total number of cache evictions.
        - `hits_time_in_millis` (DurationValueUnitMillis)
          Total combined time spent in cache for hits in milliseconds.
        - `misses_time_in_millis` (DurationValueUnitMillis)
          Total combined time spent in cache for misses in milliseconds.
## Code Examples

#### Console

```console
GET /_security/stats
```

#### curl

```curl
curl -X GET "/_security/stats"
```

## Response Examples

#### Security stats example1

A successful response from `GET /_security/stats`.

```json
{
  "nodes": {
    "CLeCBfYETO2mQ1R2Il5-SA": {
      "roles": {
        "dls": {
          "bit_set_cache": {
            "count": 1,
            "memory": "16b",
            "memory_in_bytes": 16,
            "hits": 212,
            "misses": 1,
            "evictions": 0,
            "hits_time_in_millis": 5,
            "misses_time_in_millis": 0
          }
        }
      }
    }
  }
}
```

