Skip to content

Commit 86c08f0

Browse files
committed
Some rewording, and add a note about filters in cluster stats
1 parent ff337e9 commit 86c08f0

File tree

3 files changed

+69
-42
lines changed

3 files changed

+69
-42
lines changed

docs/reference/cluster.asciidoc

Lines changed: 50 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,68 @@
66
["float",id="cluster-nodes"]
77
== Node specification
88

9-
Some cluster level APIs allow to specify nodes with _node filters_, these filters
10-
limit the results to selected nodes for corresponding APIs. (For example, you can
11-
find it in <<tasks,Task Management>> API and all the Nodes APIs like
12-
<<cluster-nodes-stats,Nodes Stats>>, <<cluster-nodes-info,Nodes Info>> etc.)
13-
14-
_Node filters_ can be one or a list filters which is comma-seperated, each filter can be:
15-
16-
* `_local`
17-
* `_master`
18-
* `_all`
19-
* a node id
20-
* a node name, node address or node hostname (could be a pattern matched using `*` wildcard)
21-
* `[master|data|ingest|coordinating_only]:[true|false]` <1> <2>
22-
* custom `attr:value` (need to be set in configuration file and could be a pattern matched using `*` wildcard) <3>
23-
24-
[NOTE]
25-
===============================================
26-
<1> pay attention that `master` means master-eligible nodes, not the current master which is represented by `_master`.
27-
<2> `false` means exclude the specified type of nodes.
28-
<3> the custom `attr:value` should be defined in configuration file.
29-
===============================================
30-
31-
IMPORTANT: node filters run in order in case of multiple, this is important when you use the exclusion case,
32-
for example `/_all,master:false` means all the nodes exclude master-eligible, but `/master:false,_all` means
33-
all the nodes as you exclude the master-eligible nodes firstly and then add all nodes in.
34-
35-
Here are some node filters examples:
9+
Some cluster-level APIs may operate on a subset of the nodes which can be
10+
specified with _node filters_. For example, the <<tasks,Task Management>>,
11+
<<cluster-nodes-stats,Nodes Stats>>, and <<cluster-nodes-info,Nodes Info>> APIs
12+
can all report results from a filtered set of nodes rather than from all nodes.
13+
14+
_Node filters_ are written as a comma-separated list of individual filters,
15+
each of which adds or removes nodes from the chosen subset. Each filter can be
16+
one of the following:
17+
18+
* `_all`, to add all nodes to the subset.
19+
* `_local`, to add the local node to the subset.
20+
* `_master`, to add the currently-elected master node to the subset.
21+
* a node id, to add this node to the set.
22+
* a pattern, using `*` wildcards, which adds all nodes to the subset
23+
whose name, address or hostname matches the pattern.
24+
* `master:true`, `data:true`, `ingest:true` or `coordinating_only:true`, which
25+
respectively add to the subset all master-eligible nodes, all data nodes,
26+
all ingest nodes, and all coordinating-only nodes.
27+
* `master:false`, `data:false`, `ingest:false` or `coordinating_only:false`,
28+
which respectively remove from the subset all master-eligible nodes, all data
29+
nodes, all ingest nodes, and all coordinating-only nodes.
30+
* a pattern, using `*` wildcards, of the form `attrname:attrvalue`, which adds
31+
to the subset all nodes with a custom node attribute that matches the
32+
pattern. Custom node attributes are configured by setting properties in the
33+
configuration file of the form `node.attr.attrname: attrvalue`.
34+
35+
NOTE: node filters run in the order in which they are given, which is important
36+
if using filters that remove nodes from the set. For example
37+
`_all,master:false` means all the nodes except the master-eligible ones, but
38+
`master:false,_all` means the same as `_all` because the `_all` filter runs
39+
after the `master:false` filter.
40+
41+
NOTE: if no filters are given, the default is to select all nodes. However, if
42+
any filters are given then they run starting with an empty chosen subset. This
43+
means that filters such as `master:false` which remove nodes from the chosen
44+
subset are only useful if they come after some other filters. When used on its
45+
own, `master:false` selects no nodes.
46+
47+
Here are some examples of the use of node filters with the
48+
<<cluster-nodes-info,Nodes Info>> APIs.
3649

3750
[source,js]
3851
--------------------------------------------------
39-
# Local node
52+
# If no filters are given, the default is to select all nodes
53+
GET /_nodes
54+
# Explicitly select all nodes
55+
GET /_nodes/_all
56+
# Select just the local node
4057
GET /_nodes/_local
41-
# Master node
58+
# Select the elected master node
4259
GET /_nodes/_master
43-
# All nodes
44-
GET /_nodes/_all
45-
# Using node name
60+
# Select nodes by name, which can include wildcards
4661
GET /_nodes/node_name_goes_here
4762
GET /_nodes/node_name_goes_*
48-
# Using address
63+
# Select nodes by address, which can include wildcards
4964
GET /_nodes/10.0.0.3,10.0.0.4
5065
GET /_nodes/10.0.0.*
51-
# Using built-in `attr:value`
66+
# Select nodes by role
5267
GET /_nodes/_all,master:false
5368
GET /_nodes/data:true,ingest:true
5469
GET /_nodes/coordinating_only:true
55-
# Using custom `attr:value` (set something like `node.attr.rack: 2` in configuration file)
70+
# Select nodes by custom attribute (e.g. with something like `node.attr.rack: 2` in the configuration file)
5671
GET /_nodes/rack:2
5772
GET /_nodes/ra*:2
5873
GET /_nodes/ra*:2*

docs/reference/cluster/nodes-hot-threads.asciidoc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
[[cluster-nodes-hot-threads]]
22
== Nodes hot_threads
33

4-
The cluster nodes hot_threads API allows to get the current hot threads on each node in the cluster.
4+
This API yields a breakdown of the hot threads on each selected node in the
5+
cluster. Its endpoints are `/_nodes/hot_threads` and
6+
`/_nodes/{nodes}/hot_threads`:
57

68
[source,js]
79
--------------------------------------------------
@@ -10,12 +12,12 @@ GET /_nodes/nodeId1,nodeId2/hot_threads
1012
--------------------------------------------------
1113
// CONSOLE
1214

13-
The first command gets the hot threads of all the nodes in the cluster.
14-
The second command selectively gets the hot threads of only `nodeId1` and `nodeId2`.
15-
All the nodes selective options are explained <<cluster-nodes,here>>.
15+
The first command gets the hot threads of all the nodes in the cluster. The
16+
second command gets the hot threads of only `nodeId1` and `nodeId2`. Nodes can
17+
be selected using <<cluster-nodes,node filters>>.
1618

17-
The output is plain text with a breakdown of each node's top hot
18-
threads. Parameters allowed are:
19+
The output is plain text with a breakdown of each node's top hot threads. The
20+
allowed parameters are:
1921

2022
[horizontal]
2123
`threads`:: number of hot threads to provide, defaults to 3.

docs/reference/cluster/stats.asciidoc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,14 @@ Will return, for example:
211211
////
212212
The TESTRESPONSE above replace all the fields values by the expected ones in the test,
213213
because we don't really care about the field values but we want to check the fields names.
214-
////
214+
////
215+
216+
This API can be restricted to a subset of the nodes using the `?nodeId`
217+
parameter, which accepts <<cluster-nodes,node filters>>:
218+
219+
[source,js]
220+
--------------------------------------------------
221+
GET /_cluster/stats?nodeId=node1,node*,master:false
222+
--------------------------------------------------
223+
// CONSOLE
224+

0 commit comments

Comments
 (0)