stats.asciidoc 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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": "1.8.0_74",
  156. "vm_name": "Java HotSpot(TM) 64-Bit Server VM",
  157. "vm_version": "25.74-b02",
  158. "vm_vendor": "Oracle Corporation",
  159. "count": 1
  160. }
  161. ],
  162. "mem": {
  163. "heap_used": "57.5mb",
  164. "heap_used_in_bytes": 60312664,
  165. "heap_max": "989.8mb",
  166. "heap_max_in_bytes": 1037959168
  167. },
  168. "threads": 90
  169. },
  170. "fs": {
  171. "total": "200.6gb",
  172. "total_in_bytes": 215429193728,
  173. "free": "32.6gb",
  174. "free_in_bytes": 35064553472,
  175. "available": "32.4gb",
  176. "available_in_bytes": 34802409472
  177. },
  178. "plugins": [
  179. {
  180. "name": "analysis-icu",
  181. "version": "{version}",
  182. "description": "The ICU Analysis plugin integrates Lucene ICU module into elasticsearch, adding ICU relates analysis components.",
  183. "classname": "org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin",
  184. "has_native_controller": false
  185. },
  186. {
  187. "name": "ingest-geoip",
  188. "version": "{version}",
  189. "description": "Ingest processor that uses looksup geo data based on ip adresses using the Maxmind geo database",
  190. "classname": "org.elasticsearch.ingest.geoip.IngestGeoIpPlugin",
  191. "has_native_controller": false
  192. },
  193. {
  194. "name": "ingest-user-agent",
  195. "version": "{version}",
  196. "description": "Ingest processor that extracts information from a user agent",
  197. "classname": "org.elasticsearch.ingest.useragent.IngestUserAgentPlugin",
  198. "has_native_controller": false
  199. },
  200. ...
  201. ],
  202. "network_types": {
  203. ...
  204. },
  205. "discovery_types": {
  206. ...
  207. }
  208. }
  209. }
  210. --------------------------------------------------
  211. // TESTRESPONSE[s/"plugins": \[[^\]]*\]/"plugins": $body.$_path/]
  212. // TESTRESPONSE[s/"network_types": \{[^\}]*\}/"network_types": $body.$_path/]
  213. // TESTRESPONSE[s/"discovery_types": \{[^\}]*\}/"discovery_types": $body.$_path/]
  214. // TESTRESPONSE[s/: (\-)?[0-9]+/: $body.$_path/]
  215. // TESTRESPONSE[s/: "[^"]*"/: $body.$_path/]
  216. // These replacements do a few things:
  217. // 1. Ignore the contents of the `plugins` object because we don't know all of
  218. // the plugins that will be in it. And because we figure folks don't need to
  219. // see an exhaustive list anyway.
  220. // 2. Similarly, ignore the contents of `network_types` and `discovery_types`.
  221. // 3. All of the numbers and strings on the right hand side of *every* field in
  222. // the response are ignored. So we're really only asserting things about the
  223. // the shape of this response, not the values in it.
  224. This API can be restricted to a subset of the nodes using the `?nodeId`
  225. parameter, which accepts <<cluster-nodes,node filters>>:
  226. [source,js]
  227. --------------------------------------------------
  228. GET /_cluster/stats?nodeId=node1,node*,master:false
  229. --------------------------------------------------
  230. // CONSOLE