---
type: api
title: Get index statistics
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-indices-stats
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-indices-stats
products:
  - Elasticsearch
---

# Get index statistics


Availability: 1.3+

## Paths

- `GET` `/{index}/_stats/{metric}`
- `GET` `/_stats/{metric}`
- `GET` `/{index}/_stats`
- `GET` `/_stats`

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

#### Path Parameters

- `index` (union IndexName | [] IndexName) — optional, leave it out to use `/_stats`
  A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
- `metric` (union string | [] string) — optional, leave it out to use `/_stats`
  Limit the information returned the specific metrics

## Description

For data streams, the API retrieves statistics for the stream's backing indices.

By default, the returned statistics are index-level with `primaries` and `total` aggregations.
`primaries` are the values for only the primary shards.
`total` are the accumulated values for both primary and replica shards.

To get shard-level statistics, set the `level` parameter to `shards`.

NOTE: When moving to another node, the shard-level statistics for a shard are cleared.
Although the shard is no longer part of the node, that node retains any node-level statistics to which the shard contributed.

## Required authorization

* Index privileges: `monitor`

## Query String Parameters

- `completion_fields` (union Fields)
  Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics.
  One of: `Field` or `Field[]`
- `expand_wildcards` (string ExpandWildcards · default: open)
  Type of index that wildcard patterns can match. If the request can target data streams, this argument
determines whether wildcard expressions match hidden data streams. Supports comma-separated values,
such as `open,hidden`.

Supported values include:
  - `all`: Match any data stream or index, including hidden ones.
  - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.
  - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.
  - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.
  - `none`: Wildcard expressions are not accepted.
  Values: `all`, `open`, `closed`, `hidden`, `none`
- `fielddata_fields` (union Fields)
  Comma-separated list or wildcard expressions of fields to include in fielddata statistics.
  One of: `Field` or `Field[]`
- `fields` (union Fields)
  Comma-separated list or wildcard expressions of fields to include in the statistics.
  One of: `Field` or `Field[]`
- `forbid_closed_indices` (boolean · default: true)
  If true, statistics are not collected from closed indices.
- `groups` (union string | [] string)
  Comma-separated list of search groups to include in the search statistics.
  One of: `string` or `string[]`
- `include_segment_file_sizes` (boolean · default: false)
  If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested).
- `include_unloaded_segments` (boolean · default: false)
  If true, the response includes information from segments that are not loaded into memory.
- `level` (enum Level · default: indices)
  Indicates whether statistics are aggregated at the cluster, indices, or shards level.
  Values: `cluster`, `indices`, `shards`

## Response

`application/json`

- `indices` (map string to IndicesStats)
  Map values ({} IndicesStats)
  - `primaries` ({} IndexStats)
    - `completion` ({} CompletionStats)
      Contains statistics about completions across all shards assigned to the node.
      - `size_in_bytes` (number)
        Total amount, in bytes, of memory used for completion across all shards assigned to selected nodes.
      - `size` (number | string ByteSize)
        Total amount of memory used for completion across all shards assigned to selected nodes.
      - `fields` (map string to FieldSizeUsage)
        Map values ({} FieldSizeUsage)
        - `size` (number | string ByteSize)
        - `size_in_bytes` (number)
    - `docs` ({} DocStats)
      Contains statistics about documents across all primary shards assigned to the node.
      - `count` (number)
        Total number of non-deleted documents across all primary shards assigned to selected nodes.
This number is based on documents in Lucene segments and may include documents from nested fields.
      - `deleted` (number)
        Total number of deleted documents across all primary shards assigned to selected nodes.
This number is based on documents in Lucene segments.
Elasticsearch reclaims the disk space of deleted Lucene documents when a segment is merged.
      - `total_size_in_bytes` (number)
        Returns the total size in bytes of all documents in this stats.
This value may be more reliable than store_stats.size_in_bytes in estimating the index size.
      - `total_size` (number | string ByteSize)
        Human readable total_size_in_bytes
    - `fielddata` ({} FielddataStats)
      Contains statistics about the field data cache across all shards assigned to the node.
      - `evictions` (number)
      - `memory_size` (number | string ByteSize)
      - `memory_size_in_bytes` (number)
      - `fields` (map string to FieldMemoryUsage)
        Map values ({} FieldMemoryUsage)
        - `memory_size` (number | string ByteSize)
        - `memory_size_in_bytes` (number)
      - `global_ordinals` ({} GlobalOrdinalsStats)
        - `build_time_in_millis` (number)
        - `build_time` (string)
        - `fields` (map string to GlobalOrdinalFieldStats)
          Map values ({} GlobalOrdinalFieldStats)
          - `build_time_in_millis` (number)
          - `build_time` (string)
          - `shard_max_value_count` (number)
    - `flush` ({} FlushStats)
      Contains statistics about flush operations for the node.
      - `periodic` (number)
      - `total` (number)
      - `total_time` (string Duration)
      - `total_time_in_millis` (DurationValueUnitMillis)
    - `get` ({} GetStats)
      Contains statistics about get operations for the node.
      - `current` (number)
      - `exists_time` (string Duration)
      - `exists_time_in_millis` (DurationValueUnitMillis)
      - `exists_total` (number)
      - `missing_time` (string Duration)
      - `missing_time_in_millis` (DurationValueUnitMillis)
      - `missing_total` (number)
      - `time` (string Duration)
      - `time_in_millis` (DurationValueUnitMillis)
      - `total` (number)
    - `indexing` ({} IndexingStats)
      Contains statistics about indexing operations for the node.
      - `index_current` (number)
      - `delete_current` (number)
      - `delete_time` (string Duration)
      - `delete_time_in_millis` (DurationValueUnitMillis)
      - `delete_total` (number)
      - `is_throttled` (boolean)
      - `noop_update_total` (number)
      - `throttle_time` (string Duration)
      - `throttle_time_in_millis` (DurationValueUnitMillis)
      - `index_time` (string Duration)
      - `index_time_in_millis` (DurationValueUnitMillis)
      - `index_total` (number)
      - `index_failed` (number)
      - `types` (map string to IndexingStats) — recursive
      - `write_load` (number)
    - `indices` ({} IndicesStats) — recursive
      Contains statistics about indices operations for the node.
    - `merges` ({} MergesStats)
      Contains statistics about merge operations for the node.
      - `current` (number)
      - `current_docs` (number)
      - `current_size` (string)
      - `current_size_in_bytes` (number)
      - `total` (number)
      - `total_auto_throttle` (string)
      - `total_auto_throttle_in_bytes` (number)
      - `total_docs` (number)
      - `total_size` (string)
      - `total_size_in_bytes` (number)
      - `total_stopped_time` (string Duration)
      - `total_stopped_time_in_millis` (DurationValueUnitMillis)
      - `total_throttled_time` (string Duration)
      - `total_throttled_time_in_millis` (DurationValueUnitMillis)
      - `total_time` (string Duration)
      - `total_time_in_millis` (DurationValueUnitMillis)
    - `query_cache` ({} QueryCacheStats)
      Contains statistics about the query cache across all shards assigned to the node.
      - `cache_count` (number)
        Total number of entries added to the query cache across all shards assigned to selected nodes.
This number includes current and evicted entries.
      - `cache_size` (number)
        Total number of entries currently in the query cache across all shards assigned to selected nodes.
      - `evictions` (number)
        Total number of query cache evictions across all shards assigned to selected nodes.
      - `hit_count` (number)
        Total count of query cache hits across all shards assigned to selected nodes.
      - `memory_size` (number | string ByteSize)
        Total amount of memory used for the query cache across all shards assigned to selected nodes.
      - `memory_size_in_bytes` (number)
        Total amount, in bytes, of memory used for the query cache across all shards assigned to selected nodes.
      - `miss_count` (number)
        Total count of query cache misses across all shards assigned to selected nodes.
      - `total_count` (number)
        Total count of hits and misses in the query cache across all shards assigned to selected nodes.
    - `recovery` ({} RecoveryStats)
      Contains statistics about recovery operations for the node.
      - `current_as_source` (number)
      - `current_as_target` (number)
      - `throttle_time` (string Duration)
      - `throttle_time_in_millis` (DurationValueUnitMillis)
    - `refresh` ({} RefreshStats)
      Contains statistics about refresh operations for the node.
      - `external_total` (number)
      - `external_total_time_in_millis` (DurationValueUnitMillis)
      - `listeners` (number)
      - `total` (number)
      - `total_time` (string Duration)
      - `total_time_in_millis` (DurationValueUnitMillis)
    - `request_cache` ({} RequestCacheStats)
      Contains statistics about the request cache across all shards assigned to the node.
      - `evictions` (number)
      - `hit_count` (number)
      - `memory_size` (string)
      - `memory_size_in_bytes` (number)
      - `miss_count` (number)
    - `search` ({} SearchStats)
      Contains statistics about search operations for the node.
      - `fetch_current` (number)
      - `fetch_time` (string Duration)
      - `fetch_time_in_millis` (DurationValueUnitMillis)
      - `fetch_total` (number)
      - `open_contexts` (number)
      - `query_current` (number)
      - `query_time` (string Duration)
      - `query_time_in_millis` (DurationValueUnitMillis)
      - `query_total` (number)
      - `scroll_current` (number)
      - `scroll_time` (string Duration)
      - `scroll_time_in_millis` (DurationValueUnitMillis)
      - `scroll_total` (number)
      - `suggest_current` (number)
      - `suggest_time` (string Duration)
      - `suggest_time_in_millis` (DurationValueUnitMillis)
      - `suggest_total` (number)
      - `groups` (map string to SearchStats) — recursive
    - `segments` ({} SegmentsStats)
      Contains statistics about segments across all shards assigned to the node.
      - `count` (number)
        Total number of segments across all shards assigned to selected nodes.
      - `doc_values_memory` (number | string ByteSize)
        Total amount of memory used for doc values across all shards assigned to selected nodes.
      - `doc_values_memory_in_bytes` (number)
        Total amount, in bytes, of memory used for doc values across all shards assigned to selected nodes.
      - `file_sizes` (map string to ShardFileSizeInfo)
        This object is not populated by the cluster stats API.
To get information on segment files, use the node stats API.
        Map values ({} ShardFileSizeInfo)
        - `description` (string)
        - `size_in_bytes` (number)
        - `min_size_in_bytes` (number)
        - `max_size_in_bytes` (number)
        - `average_size_in_bytes` (number)
        - `count` (number)
      - `fixed_bit_set` (number | string ByteSize)
        Total amount of memory used by fixed bit sets across all shards assigned to selected nodes.
Fixed bit sets are used for nested object field types and type filters for join fields.
      - `fixed_bit_set_memory_in_bytes` (number)
        Total amount of memory, in bytes, used by fixed bit sets across all shards assigned to selected nodes.
      - `index_writer_memory` (number | string ByteSize)
        Total amount of memory used by all index writers across all shards assigned to selected nodes.
      - `index_writer_memory_in_bytes` (number)
        Total amount, in bytes, of memory used by all index writers across all shards assigned to selected nodes.
      - `max_unsafe_auto_id_timestamp` (number)
        Unix timestamp, in milliseconds, of the most recently retried indexing request.
      - `memory` (number | string ByteSize)
        Total amount of memory used for segments across all shards assigned to selected nodes.
      - `memory_in_bytes` (number)
        Total amount, in bytes, of memory used for segments across all shards assigned to selected nodes.
      - `norms_memory` (number | string ByteSize)
        Total amount of memory used for normalization factors across all shards assigned to selected nodes.
      - `norms_memory_in_bytes` (number)
        Total amount, in bytes, of memory used for normalization factors across all shards assigned to selected nodes.
      - `points_memory` (number | string ByteSize)
        Total amount of memory used for points across all shards assigned to selected nodes.
      - `points_memory_in_bytes` (number)
        Total amount, in bytes, of memory used for points across all shards assigned to selected nodes.
      - `stored_fields_memory_in_bytes` (number)
        Total amount, in bytes, of memory used for stored fields across all shards assigned to selected nodes.
      - `stored_fields_memory` (number | string ByteSize)
        Total amount of memory used for stored fields across all shards assigned to selected nodes.
      - `terms_memory_in_bytes` (number)
        Total amount, in bytes, of memory used for terms across all shards assigned to selected nodes.
      - `terms_memory` (number | string ByteSize)
        Total amount of memory used for terms across all shards assigned to selected nodes.
      - `term_vectors_memory` (number | string ByteSize)
        Total amount of memory used for term vectors across all shards assigned to selected nodes.
      - `term_vectors_memory_in_bytes` (number)
        Total amount, in bytes, of memory used for term vectors across all shards assigned to selected nodes.
      - `version_map_memory` (number | string ByteSize)
        Total amount of memory used by all version maps across all shards assigned to selected nodes.
      - `version_map_memory_in_bytes` (number)
        Total amount, in bytes, of memory used by all version maps across all shards assigned to selected nodes.
    - `store` ({} StoreStats)
      Contains statistics about the size of shards assigned to the node.
      - `size` (number | string ByteSize)
        Total size of all shards assigned to selected nodes.
      - `size_in_bytes` (number)
        Total size, in bytes, of all shards assigned to selected nodes.
      - `reserved` (number | string ByteSize)
        A prediction of how much larger the shard stores will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities.
      - `reserved_in_bytes` (number)
        A prediction, in bytes, of how much larger the shard stores will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities.
      - `total_data_set_size` (number | string ByteSize)
        Total data set size of all shards assigned to selected nodes.
This includes the size of shards not stored fully on the nodes, such as the cache for partially mounted indices.
      - `total_data_set_size_in_bytes` (number)
        Total data set size, in bytes, of all shards assigned to selected nodes.
This includes the size of shards not stored fully on the nodes, such as the cache for partially mounted indices.
    - `translog` ({} TranslogStats)
      Contains statistics about transaction log operations for the node.
      - `earliest_last_modified_age` (number)
      - `operations` (number)
      - `size` (string)
      - `size_in_bytes` (number)
      - `uncommitted_operations` (number)
      - `uncommitted_size` (string)
      - `uncommitted_size_in_bytes` (number)
    - `warmer` ({} WarmerStats)
      Contains statistics about index warming operations for the node.
      - `current` (number)
      - `total` (number)
      - `total_time` (string Duration)
      - `total_time_in_millis` (DurationValueUnitMillis)
    - `bulk` ({} BulkStats)
      - `total_operations` (number)
      - `total_time` (string Duration)
      - `total_time_in_millis` (DurationValueUnitMillis)
      - `total_size` (number | string ByteSize)
      - `total_size_in_bytes` (number)
      - `avg_time` (string Duration)
      - `avg_time_in_millis` (DurationValueUnitMillis)
      - `avg_size` (number | string ByteSize)
      - `avg_size_in_bytes` (number)
    - `shard_stats` ({} ShardsTotalStats)
      - `total_count` (number)
  - `shards` (map string to ShardStats)
  - `total` ({} IndexStats)
    Same fields as `primaries` in `indices`
  - `uuid` (string)
  - `health` (enum HealthStatus)
    

Supported values include:
  - `green` (or `GREEN`): All shards are assigned.
  - `yellow` (or `YELLOW`): All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be unavailable until that node is repaired.
  - `red` (or `RED`): One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary shards are assigned.
  - `unknown`
  - `unavailable`
    Values: `green`, `GREEN`, `yellow`, `YELLOW`, `red`, `RED`, `unknown`, `unavailable`
  - `status` (enum IndexMetadataState)
    Values: `open`, `close`
- `_shards` ({} ShardStatistics)
  - `failed` (number uint)
    The number of shards the operation or search attempted to run on but failed.
  - `successful` (number uint)
    The number of shards the operation or search succeeded on.
  - `total` (number uint)
    The number of shards the operation or search will run on overall.
  - `failures` ([] ShardFailure)
    - `index` (string IndexName)
    - `node` (string)
    - `reason` ({} ErrorCause)
      - `type` (string)
        The type of error
      - `reason` (union string) — nullable
        A human-readable explanation of the error, in English.
        One of: `string`
      - `stack_trace` (string)
        The server stack trace. Present only if the `error_trace=true` parameter was sent with the request.
      - `caused_by` ({} ErrorCause) — recursive
        Same fields as `reason` in `failures`
      - `root_cause` ([] ErrorCause) — recursive
        Same fields as `reason` in `failures`
      - `suppressed` ([] ErrorCause) — recursive
        Same fields as `reason` in `failures`
    - `shard` (number)
    - `status` (string)
    - `primary` (boolean)
  - `skipped` (number uint)
- `_all` ({} IndicesStats)
  - `primaries` ({} IndexStats)
    - `completion` ({} CompletionStats)
      Contains statistics about completions across all shards assigned to the node.
      - `size_in_bytes` (number)
        Total amount, in bytes, of memory used for completion across all shards assigned to selected nodes.
      - `size` (number | string ByteSize)
        Total amount of memory used for completion across all shards assigned to selected nodes.
      - `fields` (map string to FieldSizeUsage)
        Map values ({} FieldSizeUsage)
        - `size` (number | string ByteSize)
        - `size_in_bytes` (number)
    - `docs` ({} DocStats)
      Contains statistics about documents across all primary shards assigned to the node.
      - `count` (number)
        Total number of non-deleted documents across all primary shards assigned to selected nodes.
This number is based on documents in Lucene segments and may include documents from nested fields.
      - `deleted` (number)
        Total number of deleted documents across all primary shards assigned to selected nodes.
This number is based on documents in Lucene segments.
Elasticsearch reclaims the disk space of deleted Lucene documents when a segment is merged.
      - `total_size_in_bytes` (number)
        Returns the total size in bytes of all documents in this stats.
This value may be more reliable than store_stats.size_in_bytes in estimating the index size.
      - `total_size` (number | string ByteSize)
        Human readable total_size_in_bytes
    - `fielddata` ({} FielddataStats)
      Contains statistics about the field data cache across all shards assigned to the node.
      Same fields as `fielddata` in `primaries`
    - `flush` ({} FlushStats)
      Contains statistics about flush operations for the node.
      - `periodic` (number)
      - `total` (number)
      - `total_time` (string Duration)
      - `total_time_in_millis` (DurationValueUnitMillis)
    - `get` ({} GetStats)
      Contains statistics about get operations for the node.
      Same fields as `get` in `primaries`
    - `indexing` ({} IndexingStats)
      Contains statistics about indexing operations for the node.
      Same fields as `indexing` in `primaries`
    - `indices` ({} IndicesStats) — recursive
      Contains statistics about indices operations for the node.
      Same fields as `_all`
    - `merges` ({} MergesStats)
      Contains statistics about merge operations for the node.
      Same fields as `merges` in `primaries`
    - `query_cache` ({} QueryCacheStats)
      Contains statistics about the query cache across all shards assigned to the node.
      - `cache_count` (number)
        Total number of entries added to the query cache across all shards assigned to selected nodes.
This number includes current and evicted entries.
      - `cache_size` (number)
        Total number of entries currently in the query cache across all shards assigned to selected nodes.
      - `evictions` (number)
        Total number of query cache evictions across all shards assigned to selected nodes.
      - `hit_count` (number)
        Total count of query cache hits across all shards assigned to selected nodes.
      - `memory_size` (number | string ByteSize)
        Total amount of memory used for the query cache across all shards assigned to selected nodes.
      - `memory_size_in_bytes` (number)
        Total amount, in bytes, of memory used for the query cache across all shards assigned to selected nodes.
      - `miss_count` (number)
        Total count of query cache misses across all shards assigned to selected nodes.
      - `total_count` (number)
        Total count of hits and misses in the query cache across all shards assigned to selected nodes.
    - `recovery` ({} RecoveryStats)
      Contains statistics about recovery operations for the node.
      - `current_as_source` (number)
      - `current_as_target` (number)
      - `throttle_time` (string Duration)
      - `throttle_time_in_millis` (DurationValueUnitMillis)
    - `refresh` ({} RefreshStats)
      Contains statistics about refresh operations for the node.
      - `external_total` (number)
      - `external_total_time_in_millis` (DurationValueUnitMillis)
      - `listeners` (number)
      - `total` (number)
      - `total_time` (string Duration)
      - `total_time_in_millis` (DurationValueUnitMillis)
    - `request_cache` ({} RequestCacheStats)
      Contains statistics about the request cache across all shards assigned to the node.
      - `evictions` (number)
      - `hit_count` (number)
      - `memory_size` (string)
      - `memory_size_in_bytes` (number)
      - `miss_count` (number)
    - `search` ({} SearchStats)
      Contains statistics about search operations for the node.
      Same fields as `search` in `primaries`
    - `segments` ({} SegmentsStats)
      Contains statistics about segments across all shards assigned to the node.
      Same fields as `segments` in `primaries`
    - `store` ({} StoreStats)
      Contains statistics about the size of shards assigned to the node.
      - `size` (number | string ByteSize)
        Total size of all shards assigned to selected nodes.
      - `size_in_bytes` (number)
        Total size, in bytes, of all shards assigned to selected nodes.
      - `reserved` (number | string ByteSize)
        A prediction of how much larger the shard stores will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities.
      - `reserved_in_bytes` (number)
        A prediction, in bytes, of how much larger the shard stores will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities.
      - `total_data_set_size` (number | string ByteSize)
        Total data set size of all shards assigned to selected nodes.
This includes the size of shards not stored fully on the nodes, such as the cache for partially mounted indices.
      - `total_data_set_size_in_bytes` (number)
        Total data set size, in bytes, of all shards assigned to selected nodes.
This includes the size of shards not stored fully on the nodes, such as the cache for partially mounted indices.
    - `translog` ({} TranslogStats)
      Contains statistics about transaction log operations for the node.
      - `earliest_last_modified_age` (number)
      - `operations` (number)
      - `size` (string)
      - `size_in_bytes` (number)
      - `uncommitted_operations` (number)
      - `uncommitted_size` (string)
      - `uncommitted_size_in_bytes` (number)
    - `warmer` ({} WarmerStats)
      Contains statistics about index warming operations for the node.
      - `current` (number)
      - `total` (number)
      - `total_time` (string Duration)
      - `total_time_in_millis` (DurationValueUnitMillis)
    - `bulk` ({} BulkStats)
      - `total_operations` (number)
      - `total_time` (string Duration)
      - `total_time_in_millis` (DurationValueUnitMillis)
      - `total_size` (number | string ByteSize)
      - `total_size_in_bytes` (number)
      - `avg_time` (string Duration)
      - `avg_time_in_millis` (DurationValueUnitMillis)
      - `avg_size` (number | string ByteSize)
      - `avg_size_in_bytes` (number)
    - `shard_stats` ({} ShardsTotalStats)
      - `total_count` (number)
  - `shards` (map string to ShardStats)
  - `total` ({} IndexStats)
    Same fields as `primaries` in `_all`
  - `uuid` (string)
  - `health` (enum HealthStatus)
    

Supported values include:
  - `green` (or `GREEN`): All shards are assigned.
  - `yellow` (or `YELLOW`): All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be unavailable until that node is repaired.
  - `red` (or `RED`): One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary shards are assigned.
  - `unknown`
  - `unavailable`
    Values: `green`, `GREEN`, `yellow`, `YELLOW`, `red`, `RED`, `unknown`, `unavailable`
  - `status` (enum IndexMetadataState)
    Values: `open`, `close`
## Code Examples

#### Console

```console
GET _stats/fielddata?human&fields=my_join_field#question
```

#### JavaScript

```javascript
const response = await client.indices.stats({
  metric: "fielddata",
  human: "true",
  fields: "my_join_field",
});
```

#### Python

```python
resp = client.indices.stats(
    metric="fielddata",
    human=True,
    fields="my_join_field",
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_stats/fielddata?human&fields=my_join_field#question" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java

```

#### C#

```c#
var response = await client.Indices
    .StatsAsync(d1 => d1
        .Metric("fielddata")
        .Fields(x => x.MyJoinField)
    );
```

#### PHP

```php
$resp = $client->indices()->stats([
    "metric" => "fielddata",
    "human" => "true",
    "fields" => "my_join_field",
]);
```

#### Ruby

```ruby
response = client.indices.stats(
  metric: "fielddata",
  human: "true",
  fields: "my_join_field"
)
```

