stats.asciidoc 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. },
  111. "versions": [
  112. "{version}"
  113. ],
  114. "os": {
  115. "available_processors": 8,
  116. "allocated_processors": 8,
  117. "names": [
  118. {
  119. "name": "Mac OS X",
  120. "count": 1
  121. }
  122. ],
  123. "pretty_names": [
  124. {
  125. "pretty_name": "Mac OS X",
  126. "count": 1
  127. }
  128. ],
  129. "mem" : {
  130. "total" : "16gb",
  131. "total_in_bytes" : 17179869184,
  132. "free" : "78.1mb",
  133. "free_in_bytes" : 81960960,
  134. "used" : "15.9gb",
  135. "used_in_bytes" : 17097908224,
  136. "free_percent" : 0,
  137. "used_percent" : 100
  138. }
  139. },
  140. "process": {
  141. "cpu": {
  142. "percent": 9
  143. },
  144. "open_file_descriptors": {
  145. "min": 268,
  146. "max": 268,
  147. "avg": 268
  148. }
  149. },
  150. "jvm": {
  151. "max_uptime": "13.7s",
  152. "max_uptime_in_millis": 13737,
  153. "versions": [
  154. {
  155. "version": "12",
  156. "vm_name": "OpenJDK 64-Bit Server VM",
  157. "vm_version": "12+33",
  158. "vm_vendor": "Oracle Corporation",
  159. "bundled_jdk": true,
  160. "using_bundled_jdk": true,
  161. "count": 1
  162. }
  163. ],
  164. "mem": {
  165. "heap_used": "57.5mb",
  166. "heap_used_in_bytes": 60312664,
  167. "heap_max": "989.8mb",
  168. "heap_max_in_bytes": 1037959168
  169. },
  170. "threads": 90
  171. },
  172. "fs": {
  173. "total": "200.6gb",
  174. "total_in_bytes": 215429193728,
  175. "free": "32.6gb",
  176. "free_in_bytes": 35064553472,
  177. "available": "32.4gb",
  178. "available_in_bytes": 34802409472
  179. },
  180. "plugins": [
  181. {
  182. "name": "analysis-icu",
  183. "version": "{version}",
  184. "description": "The ICU Analysis plugin integrates Lucene ICU module into elasticsearch, adding ICU relates analysis components.",
  185. "classname": "org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin",
  186. "has_native_controller": false
  187. },
  188. ...
  189. ],
  190. "network_types": {
  191. ...
  192. },
  193. "discovery_types": {
  194. ...
  195. },
  196. "packaging_types": [
  197. {
  198. ...
  199. }
  200. ]
  201. }
  202. }
  203. --------------------------------------------------
  204. // TESTRESPONSE[s/"plugins": \[[^\]]*\]/"plugins": $body.$_path/]
  205. // TESTRESPONSE[s/"network_types": \{[^\}]*\}/"network_types": $body.$_path/]
  206. // TESTRESPONSE[s/"discovery_types": \{[^\}]*\}/"discovery_types": $body.$_path/]
  207. // TESTRESPONSE[s/"packaging_types": \[[^\]]*\]/"packaging_types": $body.$_path/]
  208. // TESTRESPONSE[s/: true|false/: $body.$_path/]
  209. // TESTRESPONSE[s/: (\-)?[0-9]+/: $body.$_path/]
  210. // TESTRESPONSE[s/: "[^"]*"/: $body.$_path/]
  211. // These replacements do a few things:
  212. // 1. Ignore the contents of the `plugins` object because we don't know all of
  213. // the plugins that will be in it. And because we figure folks don't need to
  214. // see an exhaustive list anyway.
  215. // 2. Similarly, ignore the contents of `network_types`, `discovery_types`, and
  216. // `packaging_types`.
  217. // 3. All of the numbers and strings on the right hand side of *every* field in
  218. // the response are ignored. So we're really only asserting things about the
  219. // the shape of this response, not the values in it.
  220. This API can be restricted to a subset of the nodes using <<cluster-nodes,node
  221. filters>>:
  222. [source,js]
  223. --------------------------------------------------
  224. GET /_cluster/stats/nodes/node1,node*,master:false
  225. --------------------------------------------------
  226. // CONSOLE