Skip to content

Commit b010fa8

Browse files
authored
[DOCS] Reformats cat nodeattrs API (#45255)
1 parent 56a380b commit b010fa8

File tree

2 files changed

+72
-40
lines changed

2 files changed

+72
-40
lines changed

docs/reference/cat/nodeattrs.asciidoc

Lines changed: 69 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,66 @@
11
[[cat-nodeattrs]]
22
=== cat nodeattrs
33

4-
The `nodeattrs` command shows custom node attributes.
5-
For example:
4+
Returns information about custom node attributes.
5+
6+
[[cat-nodeattrs-api-request]]
7+
==== {api-request-title}
8+
9+
`GET /_cat/nodeattrs`
10+
11+
[[cat-nodeattrs-api-query-params]]
12+
==== {api-query-parms-title}
13+
14+
include::{docdir}/rest-api/common-parms.asciidoc[tag=http-format]
15+
16+
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-h]
17+
+
18+
--
19+
If you do not specify which columns to include, the API returns the default columns in the order listed below. If you explicitly specify one or more columns, it only returns the specified columns.
20+
21+
Valid columns are:
22+
23+
`node`,`name`::
24+
(Default) Name of the node, such as `DKDM97B`.
25+
26+
`host`, `h`::
27+
(Default) Host name, such as `n1`.
28+
29+
`ip`, `i`::
30+
(Default) IP address, such as `127.0.1.1`.
31+
32+
`attr`, `attr.name`::
33+
(Default) Attribute name, such as `rack`.
34+
35+
`value`, `attr.value`::
36+
(Default) Attribute value, such as `rack123`.
37+
38+
`id`, `nodeId`::
39+
ID of the node, such as `k0zy`.
40+
41+
`pid`, `p`::
42+
Process ID, such as `13061`.
43+
44+
`port`, `po`::
45+
Bound transport port, such as `9300`.
46+
--
47+
48+
include::{docdir}/rest-api/common-parms.asciidoc[tag=help]
49+
50+
include::{docdir}/rest-api/common-parms.asciidoc[tag=local]
51+
52+
include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]
53+
54+
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-s]
55+
56+
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-v]
57+
58+
59+
[[cat-nodeattrs-api-example]]
60+
==== {api-examples-title}
61+
62+
[[cat-nodeattrs-api-ex-default]]
63+
===== Example with default columns
664

765
[source,js]
866
--------------------------------------------------
@@ -12,7 +70,7 @@ GET /_cat/nodeattrs?v
1270
// TEST[s/\?v/\?v&s=node,attr/]
1371
// Sort the resulting attributes so we can assert on them more easily
1472

15-
Could look like:
73+
The API returns the following response:
1674

1775
[source,txt]
1876
--------------------------------------------------
@@ -27,27 +85,14 @@ node-0 127.0.0.1 127.0.0.1 testattr test
2785
// If xpack is installed then the first ... contains ml attributes
2886
// and the second contains xpack.installed=true
2987

30-
The first few columns (`node`, `host`, `ip`) give you basic info per node
31-
and the `attr` and `value` columns give you the custom node attributes,
32-
one per line.
33-
34-
[float]
35-
==== Columns
88+
The `node`, `host`, and `ip` columns provide basic information about each node.
89+
The `attr` and `value` columns return custom node attributes, one per line.
3690

37-
Below is an exhaustive list of the existing headers that can be
38-
passed to `nodeattrs?h=` to retrieve the relevant details in ordered
39-
columns. If no headers are specified, then those marked to Appear
40-
by Default will appear. If any header is specified, then the defaults
41-
are not used.
91+
[[cat-nodeattrs-api-ex-headings]]
92+
===== Example with explicit columns
4293

43-
Aliases can be used in place of the full header name for brevity.
44-
Columns appear in the order that they are listed below unless a
45-
different order is specified (e.g., `h=attr,value` versus `h=value,attr`).
46-
47-
When specifying headers, the headers are not placed in the output
48-
by default. To have the headers appear in the output, use verbose
49-
mode (`v`). The header name will match the supplied value (e.g.,
50-
`pid` versus `p`). For example:
94+
The following API request returns the `name`, `pid`, `attr`, and `value`
95+
columns.
5196

5297
[source,js]
5398
--------------------------------------------------
@@ -57,7 +102,7 @@ GET /_cat/nodeattrs?v&h=name,pid,attr,value
57102
// TEST[s/,value/,value&s=node,attr/]
58103
// Sort the resulting attributes so we can assert on them more easily
59104

60-
Might look like:
105+
The API returns the following response:
61106

62107
[source,txt]
63108
--------------------------------------------------
@@ -71,17 +116,4 @@ node-0 19566 testattr test
71116
// TESTRESPONSE[s/\.\.\.\n/(.+ ml\\..+\n)*/ non_json]
72117
// If xpack is not installed then neither ... with match anything
73118
// If xpack is installed then the first ... contains ml attributes
74-
// and the second contains xpack.installed=true
75-
76-
[cols="<,<,<,<,<",options="header",subs="normal"]
77-
|=======================================================================
78-
|Header |Alias |Appear by Default |Description |Example
79-
|`node`|`name`|Yes|Name of the node|DKDM97B
80-
|`id` |`nodeId` |No |Unique node ID |k0zy
81-
|`pid` |`p` |No |Process ID |13061
82-
|`host` |`h` |Yes |Host name |n1
83-
|`ip` |`i` |Yes |IP address |127.0.1.1
84-
|`port` |`po` |No |Bound transport port |9300
85-
|`attr` | `attr.name` | Yes | Attribute name | rack
86-
|`value` | `attr.value` | Yes | Attribute value | rack123
87-
|=======================================================================
119+
// and the second contains xpack.installed=true

docs/reference/rest-api/common-parms.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ tag::bytes[]
55
end::bytes[]
66

77
tag::cat-h[]
8-
`h` (headings)::
8+
`h`::
99
(Optional, string) Comma-separated list of column names to display.
1010
end::cat-h[]
1111

@@ -53,13 +53,13 @@ returned information.
5353
end::node-id[]
5454

5555
tag::cat-s[]
56-
`s` (sort)::
56+
`s`::
5757
(Optional, string) Comma-separated list of column names or column aliases used
5858
to sort the response.
5959
end::cat-s[]
6060

6161
tag::cat-v[]
62-
`v` (verbose)::
62+
`v`::
6363
(Optional, boolean) If `true`, the response includes column headings. Defaults
6464
to `false`.
6565
end::cat-v[]

0 commit comments

Comments
 (0)