AI Hints
Home›Elasticsearch Tutorial›Kibana and Your First Requests
Elasticsearch · Lesson 9 of 120

Cluster Health and _cat

Is everything OK?.

⏱ 2 min read▶ Video at 8:12🎓 Free
Watch this lesson in the Elasticsearch courseWatch on YouTube ↗Full Elasticsearch course

Before you trust a cluster, check it's healthy. Elasticsearch has a health API, and a family of cat APIs, which print short, human friendly tables.

  • Is it healthy?
  • Health API
  • cat APIs: tables

Health

Cluster health gives one status, green, yellow or red. Filter path keeps only the fields we want. Run it. Our status is green, with one node, and all shards working.

Dev Tools Consoletext
GET _cluster/health?filter_path=status,number_of_nodes,active_shards,unassigned_shards
Output
{
  "status": "green",
  "number_of_nodes": 1,
  "active_shards": 3,
  "unassigned_shards": 0
}
Also uses _setup.http
PUT products
{ "settings": { "number_of_replicas": 0 } }

The cat APIs

Cat nodes lists the nodes. Cat indices lists every index, with its health and size. The v flag adds column headers, and h picks the columns. Run it. We see our one node, and the products index.

Dev Tools Consoletext
GET _cat/nodes?v&h=name,heap.percent,cpu

GET _cat/indices?v&h=health,index,docs.count
Output
# GET _cat/nodes 200 OK
name   heap.percent cpu
node-1           38   1

# GET _cat/indices 200 OK
health index    docs.count
green  products          1
Also uses _setup.http
PUT products
{ "settings": { "number_of_replicas": 0 } }

PUT products/_doc/1?refresh=true
{ "name": "Basecamp 2-Person Tent" }

Summary

Cluster health shows green, yellow or red, and the cat APIs print quick tables of nodes and indexes. Next, creating an index on purpose.

Key takeaways
  • _cluster/health
  • _cat/nodes
  • _cat/indices
Next up: Creating an Index — settings first