stats.asciidoc 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. "mem" : {
  124. "total" : "16gb",
  125. "total_in_bytes" : 17179869184,
  126. "free" : "78.1mb",
  127. "free_in_bytes" : 81960960,
  128. "used" : "15.9gb",
  129. "used_in_bytes" : 17097908224,
  130. "free_percent" : 0,
  131. "used_percent" : 100
  132. }
  133. },
  134. "process": {
  135. "cpu": {
  136. "percent": 9
  137. },
  138. "open_file_descriptors": {
  139. "min": 268,
  140. "max": 268,
  141. "avg": 268
  142. }
  143. },
  144. "jvm": {
  145. "max_uptime": "13.7s",
  146. "max_uptime_in_millis": 13737,
  147. "versions": [
  148. {
  149. "version": "1.8.0_74",
  150. "vm_name": "Java HotSpot(TM) 64-Bit Server VM",
  151. "vm_version": "25.74-b02",
  152. "vm_vendor": "Oracle Corporation",
  153. "count": 1
  154. }
  155. ],
  156. "mem": {
  157. "heap_used": "57.5mb",
  158. "heap_used_in_bytes": 60312664,
  159. "heap_max": "989.8mb",
  160. "heap_max_in_bytes": 1037959168
  161. },
  162. "threads": 90
  163. },
  164. "fs": {
  165. "total": "200.6gb",
  166. "total_in_bytes": 215429193728,
  167. "free": "32.6gb",
  168. "free_in_bytes": 35064553472,
  169. "available": "32.4gb",
  170. "available_in_bytes": 34802409472
  171. },
  172. "plugins": [
  173. {
  174. "name": "analysis-icu",
  175. "version": "{version}",
  176. "description": "The ICU Analysis plugin integrates Lucene ICU module into elasticsearch, adding ICU relates analysis components.",
  177. "classname": "org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin",
  178. "has_native_controller": false
  179. },
  180. {
  181. "name": "ingest-geoip",
  182. "version": "{version}",
  183. "description": "Ingest processor that uses looksup geo data based on ip adresses using the Maxmind geo database",
  184. "classname": "org.elasticsearch.ingest.geoip.IngestGeoIpPlugin",
  185. "has_native_controller": false
  186. },
  187. {
  188. "name": "ingest-user-agent",
  189. "version": "{version}",
  190. "description": "Ingest processor that extracts information from a user agent",
  191. "classname": "org.elasticsearch.ingest.useragent.IngestUserAgentPlugin",
  192. "has_native_controller": false
  193. },
  194. ...
  195. ],
  196. ...
  197. }
  198. }
  199. --------------------------------------------------
  200. // TESTRESPONSE[s/"plugins": \[[^\]]*\]/"plugins": $body.$_path/]
  201. // TESTRESPONSE[s/\.\.\./"network_types": "replace_me"/]
  202. // TESTRESPONSE[s/: (\-)?[0-9]+/: $body.$_path/]
  203. // TESTRESPONSE[s/: "[^"]*"/: $body.$_path/]
  204. // These replacements do a few things:
  205. // 1. Ignore the contents of the `plugins` object because we don't know all of
  206. // the plugins that will be in it. And because we figure folks don't need to
  207. // see an exhaustive list anyway.
  208. // 2. The last ... contains more things that we don't think are important to
  209. // include in the output.
  210. // 3. All of the numbers and strings on the right hand side of *every* field in
  211. // the response are ignored. So we're really only asserting things about the
  212. // the shape of this response, not the values in it.
  213. This API can be restricted to a subset of the nodes using the `?nodeId`
  214. parameter, which accepts <<cluster-nodes,node filters>>:
  215. [source,js]
  216. --------------------------------------------------
  217. GET /_cluster/stats?nodeId=node1,node*,master:false
  218. --------------------------------------------------
  219. // CONSOLE