Skip to content

elasticsearch get-index-stats

get stats of indices

Description

Returns statistics for one or more indices. For data streams, the API retrieves statistics for the stream’s backing indices.

Synopsis

elasticsearch get-index-stats
    [--site <site>]
    [--cluster <cluster>]
    [--filter_path <filter_path>]
    <index>
    [--metrics <metrics>]

Arguments

site - (string)

     Site where this command will be executed
     Example: --site "site-1"
     Default: input.site      Attributes: optional

cluster - (string)

     Name of elastic search cluster
     Example: --cluster "elastic-default"
     Default: elastic-default      Attributes: optional

filter_path - (string)

     Path in the response. Filters and returns only parts of response matching this path
     Example: --filter_path "index.mappings.properties.*"
     Default: _None_      Attributes: optional, multiple allowed

index - (string)

     Name of indices (supports wild card expression)
     Example: "students" , "class" , "_all" , "log_2099_*"
     Default: _None_      Attributes: required, multiple allowed

metrics - (string)

     List of metrics used to limit the request. Possible values are completion, docs, field data, flush, get, indexing, merge, query_cache, refresh, request_cache, search, segments, store, suggest, translog, warmer
     Example: --metrics "fielddata,flush,refresh"
     Default: _None_      Attributes: optional, multiple allowed

Examples

Input:

! elasticsearch get-index-stats --cluster "elastic-1" "my-index-000001" "test" --metrics "refresh" --metrics "flush"
Output:
{
  "_shards": {
    "total": 4,
    "successful": 2,
    "failed": 0
  },
  "_all": {
    "primaries": {
      "refresh": {
        "total": 7,
        "total_time_in_millis": 30,
        "external_total": 6,
        "external_total_time_in_millis": 31,
        "listeners": 0
      },
      "flush": {
        "total": 3,
        "periodic": 0,
        "total_time_in_millis": 200
      }
    },
    "total": {
      "refresh": {
        "total": 7,
        "total_time_in_millis": 30,
        "external_total": 6,
        "external_total_time_in_millis": 31,
        "listeners": 0
      },
      "flush": {
        "total": 3,
        "periodic": 0,
        "total_time_in_millis": 200
      }
    }
  },
  "indices": {
    "test": {
      "uuid": "vpk0XgasRcGGTfpvF7R-SQ",
      "primaries": {
        "refresh": {
          "total": 2,
          "total_time_in_millis": 0,
          "external_total": 2,
          "external_total_time_in_millis": 0,
          "listeners": 0
        },
        "flush": {
          "total": 1,
          "periodic": 0,
          "total_time_in_millis": 0
        }
      },
      "total": {
        "refresh": {
          "total": 2,
          "total_time_in_millis": 0,
          "external_total": 2,
          "external_total_time_in_millis": 0,
          "listeners": 0
        },
        "flush": {
          "total": 1,
          "periodic": 0,
          "total_time_in_millis": 0
        }
      }
    },
    "my-index-000001": {
      "uuid": "I340__lCQhmYTtKOQkRYUA",
      "primaries": {
        "refresh": {
          "total": 5,
          "total_time_in_millis": 30,
          "external_total": 4,
          "external_total_time_in_millis": 31,
          "listeners": 0
        },
        "flush": {
          "total": 2,
          "periodic": 0,
          "total_time_in_millis": 200
        }
      },
      "total": {
        "refresh": {
          "total": 5,
          "total_time_in_millis": 30,
          "external_total": 4,
          "external_total_time_in_millis": 31,
          "listeners": 0
        },
        "flush": {
          "total": 2,
          "periodic": 0,
          "total_time_in_millis": 200
        }
      }
    }
  }
}

Access Control

To use this command, you need access to the following:

Field Value
Action "read"
Service Type "elasticsearch"
Service Instance cluster
Namespace
Object Type "index"
Object ID index

Please see Access Control for details.