mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-09 06:25:07 +00:00
This commit adds the size of the cluster state to the response for the get cluster state API call (GET /_cluster/state). The size that is returned is the size of the full cluster state in bytes when compressed. This is the same size of the full cluster state when serialized to transmit over the network. Specifying the ?human flag displays the compressed size in a more human friendly manner. Note that even if the cluster state request filters items from the cluster state (so a subset of the cluster state is returned), the size that is returned is the compressed size of the entire cluster state. Closes #3415
67 lines
2.3 KiB
Plaintext
67 lines
2.3 KiB
Plaintext
[[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'
|
|
--------------------------------------------------
|
|
|
|
The response provides the cluster name, the total compressed size
|
|
of the cluster state (its size when serialized for transmission over
|
|
the network), and the cluster state itself, which can be filtered to
|
|
only retrieve the parts of interest, as described below.
|
|
|
|
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
|
|
|
|
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.
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
$ curl -XGET 'http://localhost:9200/_cluster/state/{metrics}/{indices}'
|
|
--------------------------------------------------
|
|
|
|
`metrics` can be a comma-separated list of
|
|
|
|
`version`::
|
|
Shows the cluster state version.
|
|
|
|
`master_node`::
|
|
Shows the elected `master_node` part of the response
|
|
|
|
`nodes`::
|
|
Shows the `nodes` part of the response
|
|
|
|
`routing_table`::
|
|
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.
|
|
|
|
`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.
|
|
|
|
`blocks`::
|
|
Shows the `blocks` part of the response
|
|
|
|
A couple of example calls:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
# 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'
|
|
--------------------------------------------------
|
|
|