state.asciidoc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. [[cluster-state]]
  2. == Cluster State
  3. The cluster state API allows to get a comprehensive state information of
  4. the whole cluster.
  5. [source,js]
  6. --------------------------------------------------
  7. GET /_cluster/state
  8. --------------------------------------------------
  9. // CONSOLE
  10. The response provides the cluster name, the total compressed size
  11. of the cluster state (its size when serialized for transmission over
  12. the network), and the cluster state itself, which can be filtered to
  13. only retrieve the parts of interest, as described below.
  14. The cluster's `cluster_uuid` is also returned as part of the top-level
  15. response, in addition to the `metadata` section. added[6.4.0]
  16. NOTE: While the cluster is still forming, it is possible for the `cluster_uuid`
  17. to be `_na_` as well as the cluster state's version to be `-1`.
  18. By default, the cluster state request is routed to the master node, to
  19. ensure that the latest cluster state is returned.
  20. For debugging purposes, you can retrieve the cluster state local to a
  21. particular node by adding `local=true` to the query string.
  22. [float]
  23. === Response Filters
  24. As the cluster state can grow (depending on the number of shards and indices, your mapping, templates),
  25. it is possible to filter the cluster state response specifying the parts in the URL.
  26. [source,js]
  27. --------------------------------------------------
  28. GET /_cluster/state/{metrics}/{indices}
  29. --------------------------------------------------
  30. // CONSOLE
  31. `metrics` can be a comma-separated list of
  32. `version`::
  33. Shows the cluster state version.
  34. `master_node`::
  35. Shows the elected `master_node` part of the response
  36. `nodes`::
  37. Shows the `nodes` part of the response
  38. `routing_table`::
  39. Shows the `routing_table` part of the response. If you supply a comma separated list of indices, the returned output will only contain the indices listed.
  40. `metadata`::
  41. Shows the `metadata` part of the response. If you supply a comma separated list of indices, the returned output will only contain the indices listed.
  42. `blocks`::
  43. Shows the `blocks` part of the response
  44. The following example returns only `metadata` and `routing_table` data for the `foo` and `bar` indices:
  45. [source,js]
  46. --------------------------------------------------
  47. GET /_cluster/state/metadata,routing_table/foo,bar
  48. --------------------------------------------------
  49. // CONSOLE
  50. The next example returns everything for the `foo` and `bar` indices:
  51. [source,js]
  52. --------------------------------------------------
  53. GET /_cluster/state/_all/foo,bar
  54. --------------------------------------------------
  55. // CONSOLE
  56. And this example return only `blocks` data:
  57. [source,js]
  58. --------------------------------------------------
  59. GET /_cluster/state/blocks
  60. --------------------------------------------------
  61. // CONSOLE