state.asciidoc 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. `nodes`::
  23. Shows the `nodes` part of the response
  24. `routing_table`::
  25. 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.
  26. `metadata`::
  27. 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.
  28. `blocks`::
  29. Shows the `blocks` part of the response
  30. 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.
  31. A couple of example calls:
  32. [source,js]
  33. --------------------------------------------------
  34. # return only metadata and routing_table data for specified indices
  35. $ curl -XGET 'http://localhost:9200/_cluster/state/metadata,routing_table/foo,bar'
  36. # return everything for these two indices
  37. $ curl -XGET 'http://localhost:9200/_cluster/state/_all/foo,bar'
  38. # Return only blocks data
  39. $ curl -XGET 'http://localhost:9200/_cluster/state/blocks'
  40. # Return only metadata and a specific index_template
  41. # You should use the dedicated template endpoint for this
  42. $ curl -XGET 'http://localhost:9200/_cluster/state/metadata?index_templates=template_1'
  43. --------------------------------------------------