health.asciidoc 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. --
  2. :api: health
  3. :request: ClusterHealthRequest
  4. :response: ClusterHealthResponse
  5. --
  6. [id="{upid}-{api}"]
  7. === Cluster Health API
  8. The Cluster Health API allows getting cluster health.
  9. [id="{upid}-{api}-request"]
  10. ==== Cluster Health Request
  11. A +{request}+:
  12. ["source","java",subs="attributes,callouts,macros"]
  13. --------------------------------------------------
  14. include-tagged::{doc-tests-file}[{api}-request]
  15. --------------------------------------------------
  16. There are no required parameters. By default, the client will check all indices and will not wait
  17. for any events.
  18. ==== Indices
  19. Indices which should be checked can be passed in the constructor:
  20. ["source","java",subs="attributes,callouts,macros"]
  21. --------------------------------------------------
  22. include-tagged::{doc-tests-file}[{api}-request-indices-ctr]
  23. --------------------------------------------------
  24. Or using the corresponding setter method:
  25. ["source","java",subs="attributes,callouts,macros"]
  26. --------------------------------------------------
  27. include-tagged::{doc-tests-file}[{api}-request-indices-setter]
  28. --------------------------------------------------
  29. ==== Other parameters
  30. Other parameters can be passed only through setter methods:
  31. ["source","java",subs="attributes,callouts,macros"]
  32. --------------------------------------------------
  33. include-tagged::{doc-tests-file}[{api}-request-timeout]
  34. --------------------------------------------------
  35. <1> Timeout for the request as a `TimeValue`. Defaults to 30 seconds
  36. <2> As a `String`
  37. ["source","java",subs="attributes,callouts,macros"]
  38. --------------------------------------------------
  39. include-tagged::{doc-tests-file}[{api}-request-master-timeout]
  40. --------------------------------------------------
  41. <1> Timeout to connect to the master node as a `TimeValue`. Defaults to the same as `timeout`
  42. <2> As a `String`
  43. ["source","java",subs="attributes,callouts,macros"]
  44. --------------------------------------------------
  45. include-tagged::{doc-tests-file}[{api}-request-wait-status]
  46. --------------------------------------------------
  47. <1> The status to wait (e.g. `green`, `yellow`, or `red`). Accepts a `ClusterHealthStatus` value.
  48. <2> Using predefined method
  49. ["source","java",subs="attributes,callouts,macros"]
  50. --------------------------------------------------
  51. include-tagged::{doc-tests-file}[{api}-request-wait-events]
  52. --------------------------------------------------
  53. <1> The priority of the events to wait for. Accepts a `Priority` value.
  54. ["source","java",subs="attributes,callouts,macros"]
  55. --------------------------------------------------
  56. include-tagged::{doc-tests-file}[{api}-request-level]
  57. --------------------------------------------------
  58. <1> The level of detail of the returned health information. Accepts a +{request}.Level+ value.
  59. Default value is `cluster`.
  60. ["source","java",subs="attributes,callouts,macros"]
  61. --------------------------------------------------
  62. include-tagged::{doc-tests-file}[{api}-request-wait-relocation]
  63. --------------------------------------------------
  64. <1> Wait for 0 relocating shards. Defaults to `false`
  65. ["source","java",subs="attributes,callouts,macros"]
  66. --------------------------------------------------
  67. include-tagged::{doc-tests-file}[{api}-request-wait-initializing]
  68. --------------------------------------------------
  69. <1> Wait for 0 initializing shards. Defaults to `false`
  70. ["source","java",subs="attributes,callouts,macros"]
  71. --------------------------------------------------
  72. include-tagged::{doc-tests-file}[{api}-request-wait-nodes]
  73. --------------------------------------------------
  74. <1> Wait for `N` nodes in the cluster. Defaults to `0`
  75. <2> Using `>=N`, `<=N`, `>N` and `<N` notation
  76. <3> Using `ge(N)`, `le(N)`, `gt(N)`, `lt(N)` notation
  77. ["source","java",subs="attributes,callouts,macros"]
  78. --------------------------------------------------
  79. include-tagged::{doc-tests-file}[{api}-request-wait-active]
  80. --------------------------------------------------
  81. <1> Wait for all shards to be active in the cluster
  82. <2> Wait for `N` shards to be active in the cluster
  83. ["source","java",subs="attributes,callouts,macros"]
  84. --------------------------------------------------
  85. include-tagged::{doc-tests-file}[{api}-request-local]
  86. --------------------------------------------------
  87. <1> Non-master node can be used for this request. Defaults to `false`
  88. include::../execution.asciidoc[]
  89. [id="{upid}-{api}-response"]
  90. ==== Cluster Health Response
  91. The returned +{response}+ contains the next information about the
  92. cluster:
  93. ["source","java",subs="attributes,callouts,macros"]
  94. --------------------------------------------------
  95. include-tagged::{doc-tests-file}[{api}-response-general]
  96. --------------------------------------------------
  97. <1> Name of the cluster
  98. <2> Cluster status (`green`, `yellow` or `red`)
  99. ["source","java",subs="attributes,callouts,macros"]
  100. --------------------------------------------------
  101. include-tagged::{doc-tests-file}[{api}-response-request-status]
  102. --------------------------------------------------
  103. <1> Whether request was timed out while processing
  104. <2> Status of the request (`OK` or `REQUEST_TIMEOUT`). Other errors will be thrown as exceptions
  105. ["source","java",subs="attributes,callouts,macros"]
  106. --------------------------------------------------
  107. include-tagged::{doc-tests-file}[{api}-response-nodes]
  108. --------------------------------------------------
  109. <1> Number of nodes in the cluster
  110. <2> Number of data nodes in the cluster
  111. ["source","java",subs="attributes,callouts,macros"]
  112. --------------------------------------------------
  113. include-tagged::{doc-tests-file}[{api}-response-shards]
  114. --------------------------------------------------
  115. <1> Number of active shards
  116. <2> Number of primary active shards
  117. <3> Number of relocating shards
  118. <4> Number of initializing shards
  119. <5> Number of unassigned shards
  120. <6> Number of unassigned shards that are currently being delayed
  121. <7> Percent of active shards
  122. ["source","java",subs="attributes,callouts,macros"]
  123. --------------------------------------------------
  124. include-tagged::{doc-tests-file}[{api}-response-task]
  125. --------------------------------------------------
  126. <1> Maximum wait time of all tasks in the queue
  127. <2> Number of currently pending tasks
  128. <3> Number of async fetches that are currently ongoing
  129. ["source","java",subs="attributes,callouts,macros"]
  130. --------------------------------------------------
  131. include-tagged::{doc-tests-file}[{api}-response-indices]
  132. --------------------------------------------------
  133. <1> Detailed information about indices in the cluster
  134. ["source","java",subs="attributes,callouts,macros"]
  135. --------------------------------------------------
  136. include-tagged::{doc-tests-file}[{api}-response-index]
  137. --------------------------------------------------
  138. <1> Detailed information about a specific index
  139. ["source","java",subs="attributes,callouts,macros"]
  140. --------------------------------------------------
  141. include-tagged::{doc-tests-file}[{api}-response-shard-details]
  142. --------------------------------------------------
  143. <1> Detailed information about a specific shard