Skip to content

Commit 5ea9f3e

Browse files
committed
Note that GET /_cluster/state is unstable (#40104)
The `GET /_cluster/state` API returns an internal representation of the cluster state that does change from version to version. It's useful for debugging, but it is not intended for regular use by clients. This change adjusts the documentation of `GET /_cluster/state` to clarify that this API yields an internal representation that should not be expected to remain stable between versions. Relates #40061, #40016
1 parent dba01dd commit 5ea9f3e

File tree

1 file changed

+44
-20
lines changed

1 file changed

+44
-20
lines changed

docs/reference/cluster/state.asciidoc

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,59 @@
11
[[cluster-state]]
22
== Cluster State
33

4-
The cluster state API allows to get a comprehensive state information of
5-
the whole cluster.
4+
The cluster state API allows access to metadata representing the state of the
5+
whole cluster. This includes information such as
6+
7+
* the set of nodes in the cluster
8+
9+
* all cluster-level settings
10+
11+
* information about the indices in the cluster, including their mappings and
12+
settings
13+
14+
* the locations of all the shards in the cluster
15+
16+
The response is an internal representation of the cluster state and its format
17+
may change from version to version. If possible, you should obtain any
18+
information from the cluster state using the other, more stable,
19+
<<cluster,cluster APIs>>.
620

721
[source,js]
822
--------------------------------------------------
923
GET /_cluster/state
1024
--------------------------------------------------
1125
// CONSOLE
1226

13-
The response provides the cluster name, the total compressed size
14-
of the cluster state (its size when serialized for transmission over
15-
the network), and the cluster state itself, which can be filtered to
16-
only retrieve the parts of interest, as described below.
27+
The response provides the cluster state itself, which can be filtered to only
28+
retrieve the parts of interest as described below.
1729

18-
The cluster's `cluster_uuid` is also returned as part of the top-level
19-
response, in addition to the `metadata` section. added[6.4.0]
30+
The cluster's `cluster_uuid` is also returned as part of the top-level response,
31+
in addition to the `metadata` section. added[6.4.0]
2032

2133
NOTE: While the cluster is still forming, it is possible for the `cluster_uuid`
2234
to be `_na_` as well as the cluster state's version to be `-1`.
2335

24-
By default, the cluster state request is routed to the master node, to
25-
ensure that the latest cluster state is returned.
26-
For debugging purposes, you can retrieve the cluster state local to a
27-
particular node by adding `local=true` to the query string.
36+
By default, the cluster state request is routed to the master node, to ensure
37+
that the latest cluster state is returned. For debugging purposes, you can
38+
retrieve the cluster state local to a particular node by adding `local=true` to
39+
the query string.
2840

2941
[float]
3042
=== Response Filters
3143

32-
As the cluster state can grow (depending on the number of shards and indices, your mapping, templates),
33-
it is possible to filter the cluster state response specifying the parts in the URL.
44+
The cluster state contains information about all the indices in the cluster,
45+
including their mappings, as well as templates and other metadata. This means it
46+
can sometimes be quite large. To avoid the need to process all this information
47+
you can request only the part of the cluster state that you need:
3448

3549
[source,js]
3650
--------------------------------------------------
51+
GET /_cluster/state/{metrics}
3752
GET /_cluster/state/{metrics}/{indices}
3853
--------------------------------------------------
3954
// CONSOLE
4055

41-
`metrics` can be a comma-separated list of
56+
`{metrics}` is a comma-separated list of the following options.
4257

4358
`version`::
4459
Shows the cluster state version.
@@ -50,15 +65,23 @@ GET /_cluster/state/{metrics}/{indices}
5065
Shows the `nodes` part of the response
5166

5267
`routing_table`::
53-
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.
68+
Shows the `routing_table` part of the response. If you supply a comma
69+
separated list of indices, the returned output will only contain the routing
70+
table for these indices.
5471

5572
`metadata`::
56-
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.
73+
Shows the `metadata` part of the response. If you supply a comma separated
74+
list of indices, the returned output will only contain metadata for these
75+
indices.
5776

5877
`blocks`::
59-
Shows the `blocks` part of the response
78+
Shows the `blocks` part of the response.
79+
80+
`_all`::
81+
Shows all metrics.
6082

61-
The following example returns only `metadata` and `routing_table` data for the `foo` and `bar` indices:
83+
The following example returns only `metadata` and `routing_table` data for the
84+
`foo` and `bar` indices:
6285

6386
[source,js]
6487
--------------------------------------------------
@@ -74,7 +97,8 @@ GET /_cluster/state/_all/foo,bar
7497
--------------------------------------------------
7598
// CONSOLE
7699

77-
And this example return only `blocks` data:
100+
Finally, this example return only the `blocks` metadata:
101+
78102
[source,js]
79103
--------------------------------------------------
80104
GET /_cluster/state/blocks

0 commit comments

Comments
 (0)