state.asciidoc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. By default, the cluster state request is routed to the master node, to
  15. ensure that the latest cluster state is returned.
  16. For debugging purposes, you can retrieve the cluster state local to a
  17. particular node by adding `local=true` to the query string.
  18. [float]
  19. === Response Filters
  20. As the cluster state can grow (depending on the number of shards and indices, your mapping, templates),
  21. it is possible to filter the cluster state response specifying the parts in the URL.
  22. [source,js]
  23. --------------------------------------------------
  24. GET /_cluster/state/{metrics}/{indices}
  25. --------------------------------------------------
  26. // CONSOLE
  27. `metrics` can be a comma-separated list of
  28. `version`::
  29. Shows the cluster state version.
  30. `master_node`::
  31. Shows the elected `master_node` part of the response
  32. `nodes`::
  33. Shows the `nodes` part of the response
  34. `routing_table`::
  35. 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.
  36. `metadata`::
  37. 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.
  38. `blocks`::
  39. Shows the `blocks` part of the response
  40. The following example returns only `metadata` and `routing_table` data for the `foo` and `bar` indices:
  41. [source,js]
  42. --------------------------------------------------
  43. GET /_cluster/state/metadata,routing_table/foo,bar
  44. --------------------------------------------------
  45. // CONSOLE
  46. The next example returns everything for the `foo` and `bar` indices:
  47. [source,js]
  48. --------------------------------------------------
  49. GET /_cluster/state/_all/foo,bar
  50. --------------------------------------------------
  51. // CONSOLE
  52. And this example return only `blocks` data:
  53. [source,js]
  54. --------------------------------------------------
  55. GET /_cluster/state/blocks
  56. --------------------------------------------------
  57. // CONSOLE