stats.asciidoc 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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_id>`
  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-id]
  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=timeoutparms]
  24. [[cluster-stats-api-example]]
  25. ==== {api-examples-title}
  26. [source,console]
  27. --------------------------------------------------
  28. GET /_cluster/stats?human&pretty
  29. --------------------------------------------------
  30. // TEST[setup:twitter]
  31. The API returns the following response:
  32. ["source","js",subs="attributes,callouts"]
  33. --------------------------------------------------
  34. {
  35. "_nodes" : {
  36. "total" : 1,
  37. "successful" : 1,
  38. "failed" : 0
  39. },
  40. "cluster_uuid": "YjAvIhsCQ9CbjWZb2qJw3Q",
  41. "cluster_name": "elasticsearch",
  42. "timestamp": 1459427693515,
  43. "status": "green",
  44. "indices": {
  45. "count": 1,
  46. "shards": {
  47. "total": 5,
  48. "primaries": 5,
  49. "replication": 0,
  50. "index": {
  51. "shards": {
  52. "min": 5,
  53. "max": 5,
  54. "avg": 5
  55. },
  56. "primaries": {
  57. "min": 5,
  58. "max": 5,
  59. "avg": 5
  60. },
  61. "replication": {
  62. "min": 0,
  63. "max": 0,
  64. "avg": 0
  65. }
  66. }
  67. },
  68. "docs": {
  69. "count": 10,
  70. "deleted": 0
  71. },
  72. "store": {
  73. "size": "16.2kb",
  74. "size_in_bytes": 16684
  75. },
  76. "fielddata": {
  77. "memory_size": "0b",
  78. "memory_size_in_bytes": 0,
  79. "evictions": 0
  80. },
  81. "query_cache": {
  82. "memory_size": "0b",
  83. "memory_size_in_bytes": 0,
  84. "total_count": 0,
  85. "hit_count": 0,
  86. "miss_count": 0,
  87. "cache_size": 0,
  88. "cache_count": 0,
  89. "evictions": 0
  90. },
  91. "completion": {
  92. "size": "0b",
  93. "size_in_bytes": 0
  94. },
  95. "segments": {
  96. "count": 4,
  97. "memory": "8.6kb",
  98. "memory_in_bytes": 8898,
  99. "terms_memory": "6.3kb",
  100. "terms_memory_in_bytes": 6522,
  101. "stored_fields_memory": "1.2kb",
  102. "stored_fields_memory_in_bytes": 1248,
  103. "term_vectors_memory": "0b",
  104. "term_vectors_memory_in_bytes": 0,
  105. "norms_memory": "384b",
  106. "norms_memory_in_bytes": 384,
  107. "points_memory" : "0b",
  108. "points_memory_in_bytes" : 0,
  109. "doc_values_memory": "744b",
  110. "doc_values_memory_in_bytes": 744,
  111. "index_writer_memory": "0b",
  112. "index_writer_memory_in_bytes": 0,
  113. "version_map_memory": "0b",
  114. "version_map_memory_in_bytes": 0,
  115. "fixed_bit_set": "0b",
  116. "fixed_bit_set_memory_in_bytes": 0,
  117. "max_unsafe_auto_id_timestamp" : -9223372036854775808,
  118. "file_sizes": {}
  119. }
  120. },
  121. "nodes": {
  122. "count": {
  123. "total": 1,
  124. "data": 1,
  125. "coordinating_only": 0,
  126. "master": 1,
  127. "ingest": 1,
  128. "voting_only": 0
  129. },
  130. "versions": [
  131. "{version}"
  132. ],
  133. "os": {
  134. "available_processors": 8,
  135. "allocated_processors": 8,
  136. "names": [
  137. {
  138. "name": "Mac OS X",
  139. "count": 1
  140. }
  141. ],
  142. "pretty_names": [
  143. {
  144. "pretty_name": "Mac OS X",
  145. "count": 1
  146. }
  147. ],
  148. "mem" : {
  149. "total" : "16gb",
  150. "total_in_bytes" : 17179869184,
  151. "free" : "78.1mb",
  152. "free_in_bytes" : 81960960,
  153. "used" : "15.9gb",
  154. "used_in_bytes" : 17097908224,
  155. "free_percent" : 0,
  156. "used_percent" : 100
  157. }
  158. },
  159. "process": {
  160. "cpu": {
  161. "percent": 9
  162. },
  163. "open_file_descriptors": {
  164. "min": 268,
  165. "max": 268,
  166. "avg": 268
  167. }
  168. },
  169. "jvm": {
  170. "max_uptime": "13.7s",
  171. "max_uptime_in_millis": 13737,
  172. "versions": [
  173. {
  174. "version": "12",
  175. "vm_name": "OpenJDK 64-Bit Server VM",
  176. "vm_version": "12+33",
  177. "vm_vendor": "Oracle Corporation",
  178. "bundled_jdk": true,
  179. "using_bundled_jdk": true,
  180. "count": 1
  181. }
  182. ],
  183. "mem": {
  184. "heap_used": "57.5mb",
  185. "heap_used_in_bytes": 60312664,
  186. "heap_max": "989.8mb",
  187. "heap_max_in_bytes": 1037959168
  188. },
  189. "threads": 90
  190. },
  191. "fs": {
  192. "total": "200.6gb",
  193. "total_in_bytes": 215429193728,
  194. "free": "32.6gb",
  195. "free_in_bytes": 35064553472,
  196. "available": "32.4gb",
  197. "available_in_bytes": 34802409472
  198. },
  199. "plugins": [
  200. {
  201. "name": "analysis-icu",
  202. "version": "{version}",
  203. "description": "The ICU Analysis plugin integrates Lucene ICU module into elasticsearch, adding ICU relates analysis components.",
  204. "classname": "org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin",
  205. "has_native_controller": false
  206. },
  207. ...
  208. ],
  209. "ingest": {
  210. "number_of_pipelines" : 1,
  211. "processor_stats": {
  212. ...
  213. }
  214. },
  215. "network_types": {
  216. ...
  217. },
  218. "discovery_types": {
  219. ...
  220. },
  221. "packaging_types": [
  222. {
  223. ...
  224. }
  225. ]
  226. }
  227. }
  228. --------------------------------------------------
  229. // TESTRESPONSE[s/"plugins": \[[^\]]*\]/"plugins": $body.$_path/]
  230. // TESTRESPONSE[s/"network_types": \{[^\}]*\}/"network_types": $body.$_path/]
  231. // TESTRESPONSE[s/"discovery_types": \{[^\}]*\}/"discovery_types": $body.$_path/]
  232. // TESTRESPONSE[s/"processor_stats": \{[^\}]*\}/"processor_stats": $body.$_path/]
  233. // TESTRESPONSE[s/"count": \{[^\}]*\}/"count": $body.$_path/]
  234. // TESTRESPONSE[s/"packaging_types": \[[^\]]*\]/"packaging_types": $body.$_path/]
  235. // TESTRESPONSE[s/: true|false/: $body.$_path/]
  236. // TESTRESPONSE[s/: (\-)?[0-9]+/: $body.$_path/]
  237. // TESTRESPONSE[s/: "[^"]*"/: $body.$_path/]
  238. // These replacements do a few things:
  239. // 1. Ignore the contents of the `plugins` object because we don't know all of
  240. // the plugins that will be in it. And because we figure folks don't need to
  241. // see an exhaustive list anyway.
  242. // 2. Similarly, ignore the contents of `network_types`, `discovery_types`, and
  243. // `packaging_types`.
  244. // 3. Ignore the contents of the (nodes) count object, as what's shown here
  245. // depends on the license. Voting-only nodes are e.g. only shown when this
  246. // test runs with a basic license.
  247. // 4. All of the numbers and strings on the right hand side of *every* field in
  248. // the response are ignored. So we're really only asserting things about the
  249. // the shape of this response, not the values in it.
  250. This API can be restricted to a subset of the nodes using <<cluster-nodes,node
  251. filters>>:
  252. [source,console]
  253. --------------------------------------------------
  254. GET /_cluster/stats/nodes/node1,node*,master:false
  255. --------------------------------------------------