cat nodeattrs API
editcat nodeattrs API
editcat APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications. For application consumption, use the nodes info API.
Returns information about custom node attributes.
Request
editGET /_cat/nodeattrs
Prerequisites
edit-
If the Elasticsearch security features are enabled, you must have the
monitor
ormanage
cluster privilege to use this API.
Query parameters
edit-
format
- (Optional, string) Short version of the HTTP accept header. Valid values include JSON, YAML, etc.
-
h
-
(Optional, string) Comma-separated list of column names to display.
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
.
-
-
help
-
(Optional, Boolean) If
true
, the response includes help information. Defaults tofalse
. -
local
-
(Optional, Boolean) If
true
, the request retrieves information from the local node only. Defaults tofalse
, which means information is retrieved from the master node. -
master_timeout
-
(Optional, time units)
Period to wait for the master node. If the master node is not available before
the timeout expires, the request fails and returns an error. Defaults to
30s
. Can also be set to-1
to indicate that the request should never timeout. -
s
- (Optional, string) Comma-separated list of column names or column aliases used to sort the response.
-
v
-
(Optional, Boolean) If
true
, the response includes column headings. Defaults tofalse
.
Examples
editExample with default columns
editresp = client.cat.nodeattrs( v=True, ) print(resp)
response = client.cat.nodeattrs( v: true ) puts response
const response = await client.cat.nodeattrs({ v: "true", }); console.log(response);
GET /_cat/nodeattrs?v=true
The API returns the following response:
node host ip attr value ... node-0 127.0.0.1 127.0.0.1 testattr test ...
The node
, host
, and ip
columns provide basic information about each node.
The attr
and value
columns return custom node attributes, one per line.
Example with explicit columns
editThe following API request returns the name
, pid
, attr
, and value
columns.
resp = client.cat.nodeattrs( v=True, h="name,pid,attr,value", ) print(resp)
response = client.cat.nodeattrs( v: true, h: 'name,pid,attr,value' ) puts response
const response = await client.cat.nodeattrs({ v: "true", h: "name,pid,attr,value", }); console.log(response);
GET /_cat/nodeattrs?v=true&h=name,pid,attr,value
The API returns the following response:
name pid attr value ... node-0 19566 testattr test ...