stats.asciidoc 6.9 KB

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