ElasticSearch monitoring

ElasticSearch cluster exposes HTTP endpoint for assessing its stability.

GET _cluster/health

Sample response

{
  "cluster_name" : "testcluster",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 5,
  "active_shards" : 5,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 5,
  "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": 50.0
}

Cluster state can be assessed by value of the property called "status". Below you can find possible values with their interpretation.

StatusMeaning
green0 (OK) - Works fine
yellow1 (WARN) - There might be something wrong going on. Needs further attention.
red2 (CRIT) - Serious issue within the cluster.

Default port for ElasticSearch is 9200/TCP. It can be as well used to check if database is still runing.


What’s Next