stats.asciidoc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. [[cluster-stats]]
  2. === Cluster stats API
  3. ++++
  4. <titleabbrev>Cluster stats</titleabbrev>
  5. ++++
  6. Returns cluster statistics.
  7. [[cluster-stats-api-request]]
  8. ==== {api-request-title}
  9. `GET /_cluster/stats` +
  10. `GET /_cluster/stats/nodes/<node_filter>`
  11. [[cluster-stats-api-desc]]
  12. ==== {api-description-title}
  13. The Cluster Stats API allows to retrieve statistics from a cluster wide
  14. perspective. The API returns basic index metrics (shard numbers, store size,
  15. memory usage) and information about the current nodes that form the cluster
  16. (number, roles, os, jvm versions, memory usage, cpu and installed plugins).
  17. [[cluster-stats-api-path-params]]
  18. ==== {api-path-parms-title}
  19. include::{docdir}/rest-api/common-parms.asciidoc[tag=node-filter]
  20. [[cluster-stats-api-query-params]]
  21. ==== {api-query-parms-title}
  22. include::{docdir}/rest-api/common-parms.asciidoc[tag=flat-settings]
  23. include::{docdir}/rest-api/common-parms.asciidoc[tag=timeout]
  24. [[cluster-stats-api-response-body]]
  25. ==== {api-response-body-title}
  26. `_nodes.total`::
  27. (integer)
  28. Total number of nodes selected by the request's <<cluster-nodes,node filters>>.
  29. `_nodes.successful`::
  30. (integer)
  31. Number of nodes that responded successfully to the request.
  32. `_nodes.failed`::
  33. (integer)
  34. Number of nodes that rejected the request or failed to respond. If this value
  35. is not `0`, a reason for the rejection or failure is included in the response.
  36. `cluster_name`::
  37. (string)
  38. Name of the cluster, based on the <<cluster.name>> setting.
  39. `cluster_uuid`::
  40. (string)
  41. Unique identifier for the cluster.
  42. `timestamp`::
  43. (integer)
  44. https://en.wikipedia.org/wiki/Unix_time[Unix timestamp], in milliseconds, of
  45. the last time the cluster statistics were refreshed.
  46. `status`::
  47. include::{docdir}/rest-api/common-parms.asciidoc[tag=cluster-health-status]
  48. +
  49. See <<cluster-health>>.
  50. `indices.count`::
  51. (integer)
  52. Total number of indices with shards assigned to selected nodes.
  53. `indices.shards.total`::
  54. (integer)
  55. Total number of shards assigned to selected nodes.
  56. `indices.shards.primaries`::
  57. (integer)
  58. Number of primary shards assigned to selected nodes.
  59. `indices.shards.replication`::
  60. (integer)
  61. Ratio of replica shards to primary shards across all selected nodes.
  62. `indices.shards.index.shards.min`::
  63. (integer)
  64. Minimum number of shards in an index, counting only shards assigned to
  65. selected nodes.
  66. `indices.shards.index.shards.max`::
  67. (integer)
  68. Maximum number of shards in an index, counting only shards assigned to
  69. selected nodes.
  70. `indices.shards.index.shards.avg`::
  71. (integer)
  72. Mean number of shards in an index, counting only shards assigned to
  73. selected nodes.
  74. `indices.shards.index.primaries.min`::
  75. (integer)
  76. Minimum number of primary shards in an index, counting only shards assigned
  77. to selected nodes.
  78. `indices.shards.index.primaries.max`::
  79. (integer)
  80. Maximum number of primary shards in an index, counting only shards assigned
  81. to selected nodes.
  82. `indices.shards.index.primaries.avg`::
  83. (integer)
  84. Mean number of primary shards in an index, counting only shards assigned to
  85. selected nodes.
  86. `indices.shards.index.replication.min`::
  87. (integer)
  88. Minimum replication factor in an index, counting only shards assigned to
  89. selected nodes.
  90. `indices.shards.index.replication.max`::
  91. (integer)
  92. Maximum replication factor in an index, counting only shards assigned to
  93. selected nodes.
  94. `indices.shards.index.replication.avg`::
  95. (integer)
  96. Mean replication factor in an index, counting only shards assigned to selected
  97. nodes.
  98. `indices.docs.count`::
  99. (integer)
  100. Total number of non-deleted documents across all primary shards assigned to
  101. selected nodes.
  102. +
  103. This number is based on documents in Lucene segments and may include documents
  104. from nested fields.
  105. `indices.docs.deleted`::
  106. (integer)
  107. Total number of deleted documents across all primary shards assigned to
  108. selected nodes.
  109. +
  110. This number is based on documents in Lucene segments. {es} reclaims the disk
  111. space of deleted Lucene documents when a segment is merged.
  112. `indices.store.size`::
  113. (<<byte-units, byte units>>)
  114. Total size of all shards assigned to selected nodes.
  115. `indices.store.size_in_bytes`::
  116. (integer)
  117. Total size, in bytes, of all shards assigned to selected nodes.
  118. `indices.fielddata.memory_size`::
  119. (<<byte-units, byte units>>)
  120. Total amount of memory used for the field data cache across all shards
  121. assigned to selected nodes.
  122. `indices.fielddata.memory_size_in_bytes`::
  123. (integer)
  124. Total amount, in bytes, of memory used for the field data cache across all
  125. shards assigned to selected nodes.
  126. `indices.fielddata.evictions`::
  127. (integer)
  128. Total number of evictions from the field data cache across all shards assigned
  129. to selected nodes.
  130. `indices.query_cache.memory_size`::
  131. (<<byte-units, byte units>>)
  132. Total amount of memory used for the query cache across all shards assigned to
  133. selected nodes.
  134. `indices.query_cache.memory_size_in_bytes`::
  135. (integer)
  136. Total amount, in bytes, of memory used for the query cache across all shards
  137. assigned to selected nodes.
  138. `indices.query_cache.total_count`::
  139. (integer)
  140. Total count of hits and misses in the query cache across all shards assigned to
  141. selected nodes.
  142. `indices.query_cache.hit_count`::
  143. (integer)
  144. Total count of query cache hits across all shards assigned to selected nodes.
  145. `indices.query_cache.miss_count`::
  146. (integer)
  147. Total count of query cache misses across all shards assigned to selected nodes.
  148. `indices.query_cache.cache_size`::
  149. (integer)
  150. Total number of entries currently in the query cache across all shards assigned
  151. to selected nodes.
  152. `indices.query_cache.cache_count`::
  153. (integer)
  154. Total number of entries added to the query cache across all shards assigned
  155. to selected nodes. This number includes current and evicted entries.
  156. `indices.query_cache.evictions`::
  157. (integer)
  158. Total number of query cache evictions across all shards assigned to selected
  159. nodes.
  160. `indices.completion.size`::
  161. (<<byte-units, byte units>>)
  162. Total amount of memory used for completion across all shards assigned to
  163. selected nodes.
  164. `indices.completion.size_in_bytes`::
  165. (integer)
  166. Total amount, in bytes, of memory used for completion across all shards assigned
  167. to selected nodes.
  168. `indices.segments.count`::
  169. (integer)
  170. Total number of segments across all shards assigned to selected nodes.
  171. `indices.segments.memory`::
  172. (<<byte-units, byte units>>)
  173. Total amount of memory used for segments across all shards assigned to selected
  174. nodes.
  175. `indices.segments.memory_in_bytes`::
  176. (integer)
  177. Total amount, in bytes, of memory used for segments across all shards assigned to
  178. selected nodes.
  179. `indices.segments.terms_memory`::
  180. (<<byte-units, byte units>>)
  181. Total amount of memory used for terms across all shards assigned to selected
  182. nodes.
  183. `indices.segments.terms_memory_in_bytes`::
  184. (integer)
  185. Total amount, in bytes, of memory used for terms across all shards assigned to
  186. selected nodes.
  187. `indices.segments.stored_fields_memory`::
  188. (<<byte-units, byte units>>)
  189. Total amount of memory used for stored fields across all shards assigned to
  190. selected nodes.
  191. `indices.segments.stored_fields_memory_in_bytes`::
  192. (integer)
  193. Total amount, in bytes, of memory used for stored fields across all shards
  194. assigned to selected nodes.
  195. `indices.segments.term_vectors_memory`::
  196. (<<byte-units, byte units>>)
  197. Total amount of memory used for term vectors across all shards assigned to
  198. selected nodes.
  199. `indices.segments.term_vectors_memory_in_bytes`::
  200. (integer)
  201. Total amount, in bytes, of memory used for term vectors across all shards
  202. assigned to selected nodes.
  203. `indices.segments.norms_memory`::
  204. (<<byte-units, byte units>>)
  205. Total amount of memory used for normalization factors across all shards assigned
  206. to selected nodes.
  207. `indices.segments.norms_memory_in_bytes`::
  208. (integer)
  209. Total amount, in bytes, of memory used for normalization factors across all
  210. shards assigned to selected nodes.
  211. `indices.segments.points_memory`::
  212. (<<byte-units, byte units>>)
  213. Total amount of memory used for points across all shards assigned to selected
  214. nodes.
  215. `indices.segments.points_memory_in_bytes`::
  216. (integer)
  217. Total amount, in bytes, of memory used for points across all shards assigned to
  218. selected nodes.
  219. `indices.segments.doc_values_memory`::
  220. (<<byte-units, byte units>>)
  221. Total amount of memory used for doc values across all shards assigned to
  222. selected nodes.
  223. `indices.segments.doc_values_memory_in_bytes`::
  224. (integer)
  225. Total amount, in bytes, of memory used for doc values across all shards assigned
  226. to selected nodes.
  227. `indices.segments.index_writer_memory`::
  228. (<<byte-units, byte units>>)
  229. Total amount of memory used by all index writers across all shards assigned to
  230. selected nodes.
  231. `indices.segments.index_writer_memory_in_bytes`::
  232. (integer)
  233. Total amount, in bytes, of memory used by all index writers across all shards
  234. assigned to selected nodes.
  235. `indices.segments.version_map_memory`::
  236. (<<byte-units, byte units>>)
  237. Total amount of memory used by all version maps across all shards assigned to
  238. selected nodes.
  239. `indices.segments.version_map_memory_in_bytes`::
  240. (integer)
  241. Total amount, in bytes, of memory used by all version maps across all shards
  242. assigned to selected nodes.
  243. `indices.segments.fixed_bit_set_memory`::
  244. (<<byte-units, byte units>>)
  245. Total amount of memory used by fixed bit sets across all shards assigned to
  246. selected nodes.
  247. +
  248. Fixed bit sets are used for nested object field types and
  249. type filters for <<parent-join,join>> fields.
  250. `indices.segments.fixed_bit_set_memory_in_bytes`::
  251. (integer)
  252. Total amount of memory, in bytes, used by fixed bit sets across all shards
  253. assigned to selected nodes.
  254. `indices.segments.max_unsafe_auto_id_timestamp`::
  255. (integer)
  256. https://en.wikipedia.org/wiki/Unix_time[Unix timestamp], in milliseconds, of
  257. the most recently retried indexing request.
  258. `indices.segments.file_sizes`::
  259. (object)
  260. This object is not populated by the cluster stats API.
  261. +
  262. To get information on segment files, use the <<cluster-nodes-stats,node stats
  263. API>>.
  264. [[cluster-stats-api-example]]
  265. ==== {api-examples-title}
  266. [source,console]
  267. --------------------------------------------------
  268. GET /_cluster/stats?human&pretty
  269. --------------------------------------------------
  270. // TEST[setup:twitter]
  271. The API returns the following response:
  272. ["source","js",subs="attributes,callouts"]
  273. --------------------------------------------------
  274. {
  275. "_nodes" : {
  276. "total" : 1,
  277. "successful" : 1,
  278. "failed" : 0
  279. },
  280. "cluster_uuid": "YjAvIhsCQ9CbjWZb2qJw3Q",
  281. "cluster_name": "elasticsearch",
  282. "timestamp": 1459427693515,
  283. "status": "green",
  284. "indices": {
  285. "count": 1,
  286. "shards": {
  287. "total": 5,
  288. "primaries": 5,
  289. "replication": 0,
  290. "index": {
  291. "shards": {
  292. "min": 5,
  293. "max": 5,
  294. "avg": 5
  295. },
  296. "primaries": {
  297. "min": 5,
  298. "max": 5,
  299. "avg": 5
  300. },
  301. "replication": {
  302. "min": 0,
  303. "max": 0,
  304. "avg": 0
  305. }
  306. }
  307. },
  308. "docs": {
  309. "count": 10,
  310. "deleted": 0
  311. },
  312. "store": {
  313. "size": "16.2kb",
  314. "size_in_bytes": 16684
  315. },
  316. "fielddata": {
  317. "memory_size": "0b",
  318. "memory_size_in_bytes": 0,
  319. "evictions": 0
  320. },
  321. "query_cache": {
  322. "memory_size": "0b",
  323. "memory_size_in_bytes": 0,
  324. "total_count": 0,
  325. "hit_count": 0,
  326. "miss_count": 0,
  327. "cache_size": 0,
  328. "cache_count": 0,
  329. "evictions": 0
  330. },
  331. "completion": {
  332. "size": "0b",
  333. "size_in_bytes": 0
  334. },
  335. "segments": {
  336. "count": 4,
  337. "memory": "8.6kb",
  338. "memory_in_bytes": 8898,
  339. "terms_memory": "6.3kb",
  340. "terms_memory_in_bytes": 6522,
  341. "stored_fields_memory": "1.2kb",
  342. "stored_fields_memory_in_bytes": 1248,
  343. "term_vectors_memory": "0b",
  344. "term_vectors_memory_in_bytes": 0,
  345. "norms_memory": "384b",
  346. "norms_memory_in_bytes": 384,
  347. "points_memory" : "0b",
  348. "points_memory_in_bytes" : 0,
  349. "doc_values_memory": "744b",
  350. "doc_values_memory_in_bytes": 744,
  351. "index_writer_memory": "0b",
  352. "index_writer_memory_in_bytes": 0,
  353. "version_map_memory": "0b",
  354. "version_map_memory_in_bytes": 0,
  355. "fixed_bit_set": "0b",
  356. "fixed_bit_set_memory_in_bytes": 0,
  357. "max_unsafe_auto_id_timestamp" : -9223372036854775808,
  358. "file_sizes": {}
  359. }
  360. },
  361. "nodes": {
  362. "count": {
  363. "total": 1,
  364. "data": 1,
  365. "coordinating_only": 0,
  366. "master": 1,
  367. "ingest": 1,
  368. "voting_only": 0
  369. },
  370. "versions": [
  371. "{version}"
  372. ],
  373. "os": {
  374. "available_processors": 8,
  375. "allocated_processors": 8,
  376. "names": [
  377. {
  378. "name": "Mac OS X",
  379. "count": 1
  380. }
  381. ],
  382. "pretty_names": [
  383. {
  384. "pretty_name": "Mac OS X",
  385. "count": 1
  386. }
  387. ],
  388. "mem" : {
  389. "total" : "16gb",
  390. "total_in_bytes" : 17179869184,
  391. "free" : "78.1mb",
  392. "free_in_bytes" : 81960960,
  393. "used" : "15.9gb",
  394. "used_in_bytes" : 17097908224,
  395. "free_percent" : 0,
  396. "used_percent" : 100
  397. }
  398. },
  399. "process": {
  400. "cpu": {
  401. "percent": 9
  402. },
  403. "open_file_descriptors": {
  404. "min": 268,
  405. "max": 268,
  406. "avg": 268
  407. }
  408. },
  409. "jvm": {
  410. "max_uptime": "13.7s",
  411. "max_uptime_in_millis": 13737,
  412. "versions": [
  413. {
  414. "version": "12",
  415. "vm_name": "OpenJDK 64-Bit Server VM",
  416. "vm_version": "12+33",
  417. "vm_vendor": "Oracle Corporation",
  418. "bundled_jdk": true,
  419. "using_bundled_jdk": true,
  420. "count": 1
  421. }
  422. ],
  423. "mem": {
  424. "heap_used": "57.5mb",
  425. "heap_used_in_bytes": 60312664,
  426. "heap_max": "989.8mb",
  427. "heap_max_in_bytes": 1037959168
  428. },
  429. "threads": 90
  430. },
  431. "fs": {
  432. "total": "200.6gb",
  433. "total_in_bytes": 215429193728,
  434. "free": "32.6gb",
  435. "free_in_bytes": 35064553472,
  436. "available": "32.4gb",
  437. "available_in_bytes": 34802409472
  438. },
  439. "plugins": [
  440. {
  441. "name": "analysis-icu",
  442. "version": "{version}",
  443. "description": "The ICU Analysis plugin integrates Lucene ICU module into elasticsearch, adding ICU relates analysis components.",
  444. "classname": "org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin",
  445. "has_native_controller": false
  446. },
  447. ...
  448. ],
  449. "ingest": {
  450. "number_of_pipelines" : 1,
  451. "processor_stats": {
  452. ...
  453. }
  454. },
  455. "network_types": {
  456. ...
  457. },
  458. "discovery_types": {
  459. ...
  460. },
  461. "packaging_types": [
  462. {
  463. ...
  464. }
  465. ]
  466. }
  467. }
  468. --------------------------------------------------
  469. // TESTRESPONSE[s/"plugins": \[[^\]]*\]/"plugins": $body.$_path/]
  470. // TESTRESPONSE[s/"network_types": \{[^\}]*\}/"network_types": $body.$_path/]
  471. // TESTRESPONSE[s/"discovery_types": \{[^\}]*\}/"discovery_types": $body.$_path/]
  472. // TESTRESPONSE[s/"processor_stats": \{[^\}]*\}/"processor_stats": $body.$_path/]
  473. // TESTRESPONSE[s/"count": \{[^\}]*\}/"count": $body.$_path/]
  474. // TESTRESPONSE[s/"packaging_types": \[[^\]]*\]/"packaging_types": $body.$_path/]
  475. // TESTRESPONSE[s/: true|false/: $body.$_path/]
  476. // TESTRESPONSE[s/: (\-)?[0-9]+/: $body.$_path/]
  477. // TESTRESPONSE[s/: "[^"]*"/: $body.$_path/]
  478. // These replacements do a few things:
  479. // 1. Ignore the contents of the `plugins` object because we don't know all of
  480. // the plugins that will be in it. And because we figure folks don't need to
  481. // see an exhaustive list anyway.
  482. // 2. Similarly, ignore the contents of `network_types`, `discovery_types`, and
  483. // `packaging_types`.
  484. // 3. Ignore the contents of the (nodes) count object, as what's shown here
  485. // depends on the license. Voting-only nodes are e.g. only shown when this
  486. // test runs with a basic license.
  487. // 4. All of the numbers and strings on the right hand side of *every* field in
  488. // the response are ignored. So we're really only asserting things about the
  489. // the shape of this response, not the values in it.
  490. This API can be restricted to a subset of the nodes using <<cluster-nodes,node
  491. filters>>:
  492. [source,console]
  493. --------------------------------------------------
  494. GET /_cluster/stats/nodes/node1,node*,master:false
  495. --------------------------------------------------