Monitor and manage your Elasticsearch cluster — health, settings, nodes, shards, and shard allocation.
The cluster APIs give you visibility into the state of your cluster and let you adjust cluster-wide settings, inspect nodes, and manage shard placement.
All primary and replica shards are assigned and operational
yellow
All primary shards are assigned, but some replica shards are unassigned
red
One or more primary shards are unassigned — some data is unavailable
A yellow cluster is still fully functional for reads and writes; replica shards are just not providing redundancy. A red status means data loss risk or actual loss has occurred on one or more primary shards.
Wait for a specific status before proceeding (useful in scripts):
# Block until green or 30 seconds passcurl "http://localhost:9200/_cluster/health?wait_for_status=green&timeout=30s"
Returns the full internal state of the cluster: nodes, routing table, metadata for all indices, and more. This is a large payload — always filter it for production use.
# Full state (use with caution — very large)curl http://localhost:9200/_cluster/state# Only metadata for a specific indexcurl "http://localhost:9200/_cluster/state/metadata/products?filter_path=metadata.indices.products.settings"# Check system index flagscurl "http://localhost:9200/_cluster/state/metadata?filter_path=metadata.indices.*.system"
Prefer persistent settings over transient ones. Transient settings are cleared when the cluster restarts, which can lead to unexpected behavior after a node failure or planned restart.
Manually move or cancel shard allocations. Used to recover from allocation problems when Elasticsearch won’t allocate a shard automatically.
# Move a shard from one node to anothercurl -X POST http://localhost:9200/_cluster/reroute \ -H "Content-Type: application/json" \ -d '{ "commands": [ { "move": { "index": "products", "shard": 0, "from_node": "node-1", "to_node": "node-2" } } ] }'# Force-allocate an unassigned primary (data loss risk)curl -X POST http://localhost:9200/_cluster/reroute \ -H "Content-Type: application/json" \ -d '{ "commands": [ { "allocate_primary": { "index": "products", "shard": 0, "node": "node-1", "accept_data_loss": true } } ] }'
allocate_primary with accept_data_loss: true will assign a primary shard even if it might contain stale or missing data. Only use this as a last resort to recover from a cluster where the primary is permanently lost.
# All nodescurl http://localhost:9200/_nodes# Only master-eligible nodescurl http://localhost:9200/_nodes/master:true# Specific node by namecurl http://localhost:9200/_nodes/node-1# Data nodes onlycurl http://localhost:9200/_nodes/data:true# Specific info sectionscurl http://localhost:9200/_nodes/node-1/jvm,os,settings
Detailed runtime statistics per node: JVM heap, GC, OS, disk I/O, thread pools, indexing rates, and more.
# All stats for all nodescurl http://localhost:9200/_nodes/stats# JVM and OS stats onlycurl http://localhost:9200/_nodes/stats/jvm,os# Indices stats for a specific nodecurl http://localhost:9200/_nodes/node-1/stats/indices# Search and indexing contextscurl http://localhost:9200/_nodes/stats/indices/search
Key stat sections:
Section
Content
jvm
Heap usage, GC collections and time, thread count
os
CPU load, memory, swap, cgroup info
indices
Document count, store size, indexing rate, search rate, merge activity
thread_pool
Queue depth and rejection counts per thread pool (write, search, etc.)
The CAT (compact and aligned text) APIs return tabular plain-text output optimized for human consumption in a terminal. They are not intended for application use — use the corresponding JSON APIs instead.
# All indices with doc counts and sizescurl http://localhost:9200/_cat/indices?v# Nodes with heap usage and rolecurl http://localhost:9200/_cat/nodes?v&h=name,heap.percent,ram.percent,cpu,master,role# Shard allocation across nodescurl "http://localhost:9200/_cat/shards?v&h=index,shard,prirep,state,node,docs"# All aliasescurl http://localhost:9200/_cat/aliases?v# Thread pool queues and rejectionscurl "http://localhost:9200/_cat/thread_pool/write,search?v"
The ?v parameter adds column headers. Use ?h=col1,col2 to select specific columns.
/_cat/indices
Index health, doc count, deleted doc count, primary and total store size.
/_cat/nodes
Node name, IP, heap %, RAM %, CPU %, master indicator, and roles.
/_cat/shards
Shard state (STARTED, INITIALIZING, UNASSIGNED), primary vs replica, node assignment.
/_cat/aliases
Alias name, backing index, routing, and filter status.
CAT APIs are designed for curl and the Kibana Console. For programmatic access, always use the corresponding JSON APIs (/_cluster/health, /_nodes/stats, etc.) which provide structured, stable output.