state.asciidoc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. [[cluster-state]]
  2. === Cluster State
  3. The cluster state API allows access to metadata representing the state of the
  4. whole cluster. This includes information such as
  5. * the set of nodes in the cluster
  6. * all cluster-level settings
  7. * information about the indices in the cluster, including their mappings and
  8. settings
  9. * the locations of all the shards in the cluster
  10. The response is an internal representation of the cluster state and its format
  11. may change from version to version. If possible, you should obtain any
  12. information from the cluster state using the other, more stable,
  13. <<cluster,cluster APIs>>.
  14. [source,js]
  15. --------------------------------------------------
  16. GET /_cluster/state
  17. --------------------------------------------------
  18. // CONSOLE
  19. The response provides the cluster state itself, which can be filtered to only
  20. retrieve the parts of interest as described below.
  21. The cluster's `cluster_uuid` is also returned as part of the top-level response,
  22. in addition to the `metadata` section. added[6.4.0]
  23. NOTE: While the cluster is still forming, it is possible for the `cluster_uuid`
  24. to be `_na_` as well as the cluster state's version to be `-1`.
  25. By default, the cluster state request is routed to the master node, to ensure
  26. that the latest cluster state is returned. For debugging purposes, you can
  27. retrieve the cluster state local to a particular node by adding `local=true` to
  28. the query string.
  29. [float]
  30. ==== Response Filters
  31. The cluster state contains information about all the indices in the cluster,
  32. including their mappings, as well as templates and other metadata. This means it
  33. can sometimes be quite large. To avoid the need to process all this information
  34. you can request only the part of the cluster state that you need:
  35. [source,js]
  36. --------------------------------------------------
  37. GET /_cluster/state/{metrics}
  38. GET /_cluster/state/{metrics}/{indices}
  39. --------------------------------------------------
  40. // CONSOLE
  41. `{metrics}` is a comma-separated list of the following options.
  42. `version`::
  43. Shows the cluster state version.
  44. `master_node`::
  45. Shows the elected `master_node` part of the response
  46. `nodes`::
  47. Shows the `nodes` part of the response
  48. `routing_table`::
  49. Shows the `routing_table` part of the response. If you supply a comma
  50. separated list of indices, the returned output will only contain the routing
  51. table for these indices.
  52. `metadata`::
  53. Shows the `metadata` part of the response. If you supply a comma separated
  54. list of indices, the returned output will only contain metadata for these
  55. indices.
  56. `blocks`::
  57. Shows the `blocks` part of the response.
  58. `_all`::
  59. Shows all metrics.
  60. The following example returns only `metadata` and `routing_table` data for the
  61. `foo` and `bar` indices:
  62. [source,js]
  63. --------------------------------------------------
  64. GET /_cluster/state/metadata,routing_table/foo,bar
  65. --------------------------------------------------
  66. // CONSOLE
  67. The next example returns everything for the `foo` and `bar` indices:
  68. [source,js]
  69. --------------------------------------------------
  70. GET /_cluster/state/_all/foo,bar
  71. --------------------------------------------------
  72. // CONSOLE
  73. Finally, this example return only the `blocks` metadata:
  74. [source,js]
  75. --------------------------------------------------
  76. GET /_cluster/state/blocks
  77. --------------------------------------------------
  78. // CONSOLE