state.asciidoc 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. By default, the cluster state request is routed to the master node, to
  10. ensure that the latest cluster state is returned.
  11. For debugging purposes, you can retrieve the cluster state local to a
  12. particular node by adding `local=true` to the query string.
  13. [float]
  14. === Response Filters
  15. As the cluster state can grow (depending on the number of shards and indices, your mapping, templates),
  16. it is possible to filter the cluster state response specifying the parts in the URL.
  17. [source,js]
  18. --------------------------------------------------
  19. $ curl -XGET 'http://localhost:9200/_cluster/state/{metrics}/{indices}'
  20. --------------------------------------------------
  21. `metrics` can be a comma-separated list of
  22. `version`::
  23. Shows the cluster state version.
  24. `master_node`::
  25. Shows the elected `master_node` part of the response
  26. `nodes`::
  27. Shows the `nodes` part of the response
  28. `routing_table`::
  29. 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.
  30. `metadata`::
  31. 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.
  32. `blocks`::
  33. Shows the `blocks` part of the response
  34. In addition the `index_templates` parameter can be specified, which returns the specified index templates only. This works only if the `metadata` is asked to be returned.
  35. A couple of example calls:
  36. [source,js]
  37. --------------------------------------------------
  38. # return only metadata and routing_table data for specified indices
  39. $ curl -XGET 'http://localhost:9200/_cluster/state/metadata,routing_table/foo,bar'
  40. # return everything for these two indices
  41. $ curl -XGET 'http://localhost:9200/_cluster/state/_all/foo,bar'
  42. # Return only blocks data
  43. $ curl -XGET 'http://localhost:9200/_cluster/state/blocks'
  44. # Return only metadata and a specific index_template
  45. # You should use the dedicated template endpoint for this
  46. $ curl -XGET 'http://localhost:9200/_cluster/state/metadata?index_templates=template_1'
  47. --------------------------------------------------