state.asciidoc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. $ curl -XGET 'http://localhost:9200/_cluster/state'
  8. --------------------------------------------------
  9. The response provides the cluster name, the total compressed size
  10. of the cluster state (its size when serialized for transmission over
  11. the network), and the cluster state itself, which can be filtered to
  12. only retrieve the parts of interest, as described below.
  13. By default, the cluster state request is routed to the master node, to
  14. ensure that the latest cluster state is returned.
  15. For debugging purposes, you can retrieve the cluster state local to a
  16. particular node by adding `local=true` to the query string.
  17. [float]
  18. === Response Filters
  19. As the cluster state can grow (depending on the number of shards and indices, your mapping, templates),
  20. it is possible to filter the cluster state response specifying the parts in the URL.
  21. [source,js]
  22. --------------------------------------------------
  23. $ curl -XGET 'http://localhost:9200/_cluster/state/{metrics}/{indices}'
  24. --------------------------------------------------
  25. `metrics` can be a comma-separated list of
  26. `version`::
  27. Shows the cluster state version.
  28. `master_node`::
  29. Shows the elected `master_node` part of the response
  30. `nodes`::
  31. Shows the `nodes` part of the response
  32. `routing_table`::
  33. 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.
  34. `metadata`::
  35. 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.
  36. `blocks`::
  37. Shows the `blocks` part of the response
  38. A couple of example calls:
  39. [source,js]
  40. --------------------------------------------------
  41. # return only metadata and routing_table data for specified indices
  42. $ curl -XGET 'http://localhost:9200/_cluster/state/metadata,routing_table/foo,bar'
  43. # return everything for these two indices
  44. $ curl -XGET 'http://localhost:9200/_cluster/state/_all/foo,bar'
  45. # Return only blocks data
  46. $ curl -XGET 'http://localhost:9200/_cluster/state/blocks'
  47. --------------------------------------------------