2022-04-22 12:39:12 -04:00
---
layout: default
2022-05-20 05:36:23 -04:00
title: Nodes APIs
2022-04-22 12:39:12 -04:00
has_children: true
2022-10-27 12:50:39 -04:00
nav_order: 50
2022-04-22 12:39:12 -04:00
---
2022-05-19 11:23:12 -04:00
# Nodes API
2022-04-22 12:39:12 -04:00
2022-10-08 18:02:27 -04:00
The nodes API makes it possible to retrieve information about individual nodes within your cluster.
2022-04-22 12:39:12 -04:00
## Node filters
2022-10-08 18:02:27 -04:00
Use the `<node-filters>` parameter to filter the target set of nodes in the API response.
< style >
table th:first-of-type {
width: 25%;
}
table th:nth-of-type(2) {
width: 10%;
}
table th:nth-of-type(3) {
width: 65%;
}
< / style >
2022-04-22 12:39:12 -04:00
Parameter | Type | Description
:--- |:-------| :---
2022-10-08 18:02:27 -04:00
`<node-filters>` | String | A comma-separated list of resolution mechanisms that OpenSearch uses to identify cluster nodes.
2022-04-22 12:39:12 -04:00
2022-10-08 18:02:27 -04:00
Node filters support several node resolution mechanisms:
2022-04-22 12:39:12 -04:00
2022-10-08 18:02:27 -04:00
- Predefined constants: `_local` , `_cluster_manager` , or `_all` .
2022-05-19 11:23:12 -04:00
- An exact match for `nodeID`
2022-10-08 18:02:27 -04:00
- A simple case-sensitive wildcard pattern matching for `node-name` , `host-name` , or `host-IP-address` .
- Node roles where the `<bool>` value is set either to `true` or `false` :
- `cluster_manager:<bool>` refers to all cluster manager-eligible nodes.
- `data:<bool>` refers to all data nodes.
- `ingest:<bool>` refers to all ingest nodes.
- `voting_only:<bool>` refers to all voting-only nodes.
- `ml:<bool>` refers to all machine learning (ML) nodes.
- `coordinating_only:<bool>` refers to all coordinating-only nodes.
2022-05-18 11:34:34 -04:00
- A simple case-sensitive wildcard pattern matching for node attributes: `<node attribute*>:<attribute value*>` . The wildcard matching pattern can be used in both the key and value at the same time.
2022-04-22 12:39:12 -04:00
2022-05-18 11:34:34 -04:00
Resolution mechanisms are applied sequentially in the order specified by the client. Each mechanism specification can either add or remove nodes.
2022-04-22 12:39:12 -04:00
2022-10-08 18:02:27 -04:00
To get statistics from the elected cluster manager node only, use the following query :
2022-04-22 12:39:12 -04:00
2022-10-08 18:02:27 -04:00
```json
2022-04-22 12:39:12 -04:00
GET /_nodes/_cluster_manager/stats
```
2023-01-30 17:09:38 -05:00
{% include copy-curl.html %}
2022-04-22 12:39:12 -04:00
2022-10-08 18:02:27 -04:00
To get statistics from nodes that are data-only nodes, use the following query:
2022-05-18 11:34:34 -04:00
2022-10-08 18:02:27 -04:00
```json
2022-04-22 12:39:12 -04:00
GET /_nodes/data:true/stats
```
2023-01-30 17:09:38 -05:00
{% include copy-curl.html %}
2022-04-22 12:39:12 -04:00
2022-05-18 11:34:34 -04:00
### Order of resolution mechanisms
2022-04-22 12:39:12 -04:00
2022-10-08 18:02:27 -04:00
The order of resolution mechanisms is applied sequentially, and each can add or remove nodes. The following examples yield different results.
2022-05-18 11:34:34 -04:00
2022-10-08 18:02:27 -04:00
To get statistics from all the nodes except the cluster manager node, use the following query:
2022-05-18 11:34:34 -04:00
2022-10-08 18:02:27 -04:00
```json
2022-05-18 13:54:11 -04:00
GET /_nodes/_all,cluster_manager:false/stats
2022-04-22 12:39:12 -04:00
```
2023-01-30 17:09:38 -05:00
{% include copy-curl.html %}
2022-04-22 12:39:12 -04:00
2022-10-08 18:02:27 -04:00
However, if you switch the resolution mechanisms, the result will include all the cluster nodes, including the cluster manager node:
2022-05-18 11:34:34 -04:00
2022-10-08 18:02:27 -04:00
```json
GET /_nodes/cluster_manager:false,_all/stats
2023-01-30 17:09:38 -05:00
```
{% include copy-curl.html %}