2013-08-28 19:24:34 -04:00
[[cluster-state]]
== Cluster State
The cluster state API allows to get a comprehensive state information of
the whole cluster.
[source,js]
--------------------------------------------------
$ curl -XGET 'http://localhost:9200/_cluster/state'
--------------------------------------------------
By default, the cluster state request is routed to the master node, to
ensure that the latest cluster state is returned.
For debugging purposes, you can retrieve the cluster state local to a
particular node by adding `local=true` to the query string.
[float]
=== Response Filters
2014-01-08 03:20:56 -05:00
As the cluster state can grow (depending on the number of shards and indices, your mapping, templates),
it is possible to filter the cluster state response specifying the parts in the URL.
2013-08-28 19:24:34 -04:00
2014-01-08 03:20:56 -05:00
[source,js]
--------------------------------------------------
$ curl -XGET 'http://localhost:9200/_cluster/state/{metrics}/{indices}'
--------------------------------------------------
`metrics` can be a comma-separated list of
2014-02-09 20:24:03 -05:00
`version`::
Shows the cluster state version.
`master_node`::
Shows the elected `master_node` part of the response
2014-01-08 03:20:56 -05:00
`nodes`::
Shows the `nodes` part of the response
2013-08-28 19:24:34 -04:00
2014-02-09 20:24:03 -05:00
`routing_table`::
2014-01-08 03:20:56 -05:00
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.
2013-08-28 19:24:34 -04:00
2014-01-08 03:20:56 -05:00
`metadata`::
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.
2013-08-28 19:24:34 -04:00
2014-01-08 03:20:56 -05:00
`blocks`::
Shows the `blocks` part of the response
2013-08-28 19:24:34 -04:00
2014-01-08 03:20:56 -05:00
A couple of example calls:
2013-08-28 19:24:34 -04:00
[source,js]
--------------------------------------------------
2014-01-08 03:20:56 -05:00
# return only metadata and routing_table data for specified indices
$ curl -XGET 'http://localhost:9200/_cluster/state/metadata,routing_table/foo,bar'
# return everything for these two indices
$ curl -XGET 'http://localhost:9200/_cluster/state/_all/foo,bar'
# Return only blocks data
$ curl -XGET 'http://localhost:9200/_cluster/state/blocks'
2013-08-28 19:24:34 -04:00
--------------------------------------------------
2014-01-08 03:20:56 -05:00