120 lines
3.4 KiB
Plaintext
120 lines
3.4 KiB
Plaintext
[[cat-nodeattrs]]
|
|
=== cat nodeattrs API
|
|
++++
|
|
<titleabbrev>cat nodeattrs</titleabbrev>
|
|
++++
|
|
|
|
Returns information about custom node attributes.
|
|
|
|
[[cat-nodeattrs-api-request]]
|
|
==== {api-request-title}
|
|
|
|
`GET /_cat/nodeattrs`
|
|
|
|
[[cat-nodeattrs-api-query-params]]
|
|
==== {api-query-parms-title}
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=http-format]
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-h]
|
|
+
|
|
--
|
|
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.
|
|
|
|
Valid columns are:
|
|
|
|
`node`,`name`::
|
|
(Default) Name of the node, such as `DKDM97B`.
|
|
|
|
`host`, `h`::
|
|
(Default) Host name, such as `n1`.
|
|
|
|
`ip`, `i`::
|
|
(Default) IP address, such as `127.0.1.1`.
|
|
|
|
`attr`, `attr.name`::
|
|
(Default) Attribute name, such as `rack`.
|
|
|
|
`value`, `attr.value`::
|
|
(Default) Attribute value, such as `rack123`.
|
|
|
|
`id`, `nodeId`::
|
|
ID of the node, such as `k0zy`.
|
|
|
|
`pid`, `p`::
|
|
Process ID, such as `13061`.
|
|
|
|
`port`, `po`::
|
|
Bound transport port, such as `9300`.
|
|
--
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=help]
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=local]
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-s]
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-v]
|
|
|
|
|
|
[[cat-nodeattrs-api-example]]
|
|
==== {api-examples-title}
|
|
|
|
[[cat-nodeattrs-api-ex-default]]
|
|
===== Example with default columns
|
|
|
|
[source,console]
|
|
--------------------------------------------------
|
|
GET /_cat/nodeattrs?v
|
|
--------------------------------------------------
|
|
// TEST[s/\?v/\?v&s=node,attr/]
|
|
// Sort the resulting attributes so we can assert on them more easily
|
|
|
|
The API returns the following response:
|
|
|
|
[source,txt]
|
|
--------------------------------------------------
|
|
node host ip attr value
|
|
...
|
|
node-0 127.0.0.1 127.0.0.1 testattr test
|
|
...
|
|
--------------------------------------------------
|
|
// TESTRESPONSE[s/\.\.\.\n$/\n(.+ xpack\\.installed true\n)?\n/]
|
|
// TESTRESPONSE[s/\.\.\.\n/(.+ ml\\..+\n)*/ non_json]
|
|
// If xpack is not installed then neither ... with match anything
|
|
// If xpack is installed then the first ... contains ml attributes
|
|
// and the second contains xpack.installed=true
|
|
|
|
The `node`, `host`, and `ip` columns provide basic information about each node.
|
|
The `attr` and `value` columns return custom node attributes, one per line.
|
|
|
|
[[cat-nodeattrs-api-ex-headings]]
|
|
===== Example with explicit columns
|
|
|
|
The following API request returns the `name`, `pid`, `attr`, and `value`
|
|
columns.
|
|
|
|
[source,console]
|
|
--------------------------------------------------
|
|
GET /_cat/nodeattrs?v&h=name,pid,attr,value
|
|
--------------------------------------------------
|
|
// TEST[s/,value/,value&s=node,attr/]
|
|
// Sort the resulting attributes so we can assert on them more easily
|
|
|
|
The API returns the following response:
|
|
|
|
[source,txt]
|
|
--------------------------------------------------
|
|
name pid attr value
|
|
...
|
|
node-0 19566 testattr test
|
|
...
|
|
--------------------------------------------------
|
|
// TESTRESPONSE[s/19566/\\d*/]
|
|
// TESTRESPONSE[s/\.\.\.\n$/\n(.+ xpack\\.installed true\n)?\n/]
|
|
// TESTRESPONSE[s/\.\.\.\n/(.+ ml\\..+\n)*/ non_json]
|
|
// If xpack is not installed then neither ... with match anything
|
|
// If xpack is installed then the first ... contains ml attributes
|
|
// and the second contains xpack.installed=true |