Skip to content

elasticsearch get-cluster-health

Get elastic search cluster health

Description

Get the health status of a cluster

Synopsis

elasticsearch get-cluster-health
    [--site <site>]
    [--cluster <cluster>]
    [--filter_path <filter_path>]
    [--raw]
    [--target <target>]
    [--level <level>]
    [--local]

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

raw - (bool)

     If false, returns compact and aligned text output
     Example: --raw
     Default: _None_      Attributes: optional

target - (string)

     List of data streams, indices, and index aliases used to limit the request
     Example: --target "students or _all"
     Default: _all      Attributes: optional, multiple allowed

level - (string)

     Can be either cluster/indices/shards. Controls the details level of the health information returned
     Example: --level "cluster"
     Default: cluster      Attributes: optional

local - (bool)

     If set, the request retrieves information from the local node only. By default information is retrieved from the master node.
     Example: --local
     Default: _None_      Attributes: optional

Examples

Input:

! elasticsearch get-cluster-health --cluster "elastic-1" --target "class" --target "test" --level "cluster" --local --raw
Output:
{
  "cluster_name": "default",
  "status": "yellow",
  "timed_out": false,
  "number_of_nodes": 1,
  "number_of_data_nodes": 1,
  "active_primary_shards": 3,
  "active_shards": 3,
  "relocating_shards": 0,
  "initializing_shards": 0,
  "unassigned_shards": 3,
  "delayed_unassigned_shards": 0,
  "number_of_pending_tasks": 0,
  "number_of_in_flight_fetch": 0,
  "task_max_waiting_in_queue_millis": 0,
  "active_shards_percent_as_number": 14.634146341463413
}
Input:
! elasticsearch get-cluster-health
Output:
[
  {
    "epoch": "1639500455",
    "timestamp": "16:47:35",
    "cluster": "default",
    "status": "red",
    "node.total": "1",
    "node.data": "1",
    "shards": "20",
    "pri": "20",
    "relo": "0",
    "init": "0",
    "unassign": "81",
    "pending_tasks": "0",
    "max_task_wait_time": "-",
    "active_shards_percent": "19.8%"
  }
]

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 "cluster"
Object ID

Please see Access Control for details.