Master Elasticsearch Node Commands: Inspect, Monitor, and Troubleshoot Your Cluster
This article walks through essential Elasticsearch node‑level APIs—covering how to retrieve basic node info, detailed statistics, thread‑pool usage, and hot‑thread diagnostics—complete with request examples, response samples, and practical tips for diagnosing common cluster issues.
Node‑related Commands
1. View basic node information
The
GET /_nodes/<node_id>API returns all details of a node, including process, JVM, plugins, roles, attributes, and settings.
<code>GET /_nodes/<node_id></code>To fetch only specific sections, append the sub‑path, e.g.,
GET /_nodes/<node_id>/process:
<code>GET /_nodes/<node_id>/process</code>Sample response:
<code>{
"_nodes" : {"total" : 1,"successful" : 1,"failed" : 0},
"cluster_name" : "es-xxxx",
"nodes" : {
"fdaOV16OQPq6-AUVihmq4A" : {
"name" : "162680s31430001456s32",
"transport_address" : "xx.0.96.22:9300",
"host" : "xx.0.96.22",
"ip" : "xx.0.96.22",
"version" : "7.10.1",
"roles" : ["master","ml","remote_cluster_client"],
"attributes" : {
"ml.machine_memory" : "16478932992",
"rack" : "cvm_4_200003",
"xpack.installed" : "true",
"set" : "200003",
"transform.node" : "false",
"ip" : "xx.20.58.221",
"temperature" : "hot",
"ml.max_open_jobs" : "20",
"region" : "4"
},
"process" : {"refresh_interval_in_millis" : 1000,"id" : 24918,"mlockall" : false}
}
}
}
</code>2. View node statistics
The
GET /_nodes/statsAPI provides comprehensive metrics such as JVM, CPU, memory, disk usage, index counts, request counts, cache statistics, segment and translog data.
<code>GET /_nodes/stats
GET /_nodes/<node_id>/stats
GET /_nodes/stats/<metric></code>Example: retrieve only JVM metrics for a specific node.
<code>GET /_nodes/1626803143000145632/stats/jvm</code>Sample response (truncated):
<code>{
"_nodes" : {"total" : 1,"successful" : 1,"failed" : 0},
"cluster_name" : "es-xxx",
"nodes" : {
"fdaOV16OQPq6-AUVihmq4A" : {
"timestamp" : 1639878427713,
"jvm" : {
"uptime_in_millis" : 13037976328,
"mem" : {
"heap_used_in_bytes" : 214161760,
"heap_used_percent" : 2,
"heap_committed_in_bytes" : 8555069440,
"heap_max_in_bytes" : 8555069440
},
"threads" : {"count" : 41,"peak_count" : 43},
"gc" : {"collectors" : {"young" : {"collection_count" : 4718,"collection_time_in_millis" : 162825},"old" : {"collection_count" : 3,"collection_time_in_millis" : 359}}}
}
}
}
}
</code>Other useful stats include merge information, segment & translog details, and store size:
<code>GET /_nodes/1626803143000145632/stats/indices/merge
GET /_nodes/1626803143000145632/stats/indices/segments,translog
GET /_nodes/stats/indices/store</code>For a quick overview of node memory usage, the cat API is handy:
<code>GET _cat/nodes
GET _cat/nodes?h=name,segments.memory,segments.index_writer_memory,heap.percent,fielddata.memory_size,query_cache.memory_size,request_cache.memory_size\&v</code>3. View thread‑pool usage
Use the cat thread‑pool API to see active, queued, and rejected tasks. High values in
queueor
rejectedindicate that the node’s read/write capacity is saturated, often caused by high CPU usage.
<code>GET /_cat/thread_pool
GET /_cat/thread_pool/search,write?v</code>Sample response:
<code>node_name name active queue rejected
1626803143000145832 search 0 0 0
1626803143000145832 write 0 0 0
...</code>Typical symptoms such as query rejections are illustrated below:
When the thread‑pool queue is full, the logs look similar to the following screenshot:
4. View hot threads
The hot‑thread API helps pinpoint CPU‑intensive tasks on a node.
<code>GET /_nodes/hot_threads
GET /_nodes/<node_id>/hot_threads</code>Sample output (truncated):
<code>::: {1626803143000145832}{...}
Hot threads at 2021-12-19T02:21:12.334Z, interval=500ms, busiestThreads=3, ignoreIdleThreads=true:
...
</code>Analyzing hot threads together with CPU metrics helps identify root causes such as frequent merges, heavy text analysis, or snapshot operations.
Command Summary Table
Efficient Ops
This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.