---
type: api
title: Get the hot threads for nodes
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-nodes-hot-threads
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-nodes-hot-threads
products:
  - Elasticsearch
---

# Get the hot threads for nodes


## Paths

- `GET` `/_nodes/{node_id}/hot_threads`
- `GET` `/_nodes/hot_threads`

#### Path parameters

- `node_id` (union string | string[]) — optional, leave it out to use `/_nodes/hot_threads`
  List of node IDs or names used to limit returned information.

## Description

Get a breakdown of the hot threads on each selected node in the cluster.
The output is plain text with a breakdown of the top hot threads for each node.

## Required authorization

- Cluster privileges: `monitor`, `manage`

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)

## Query string parameters

- `ignore_idle_threads` (boolean · default: true) — optional
  If true, known idle threads (e.g. waiting in a socket select, or to get
a task from an empty queue) are filtered out.
- `interval` (string · default: 500ms) — optional
  The interval to do the second sampling of threads.
- `snapshots` (number · default: 10) — optional
  Number of samples of thread stacktrace.
- `threads` (number · default: 3) — optional
  Specifies the number of hot threads to provide information for.
- `timeout` (string · default: 30s) — optional
  Period to wait for a response. If no response is received
before the timeout expires, the request fails and returns an error.
- `type` (enum · default: cpu) — optional
  The type to sample.

Supported values include:
  - `cpu`: Threads that consume the most CPU time.
  - `wait`: Threads that have been in a waiting state the longest.
  - `block`: Threads that have been blocked the longest.
  - `gpu`: Threads that consume the most GPU time.
  - `mem`: Threads that allocate the most memory.
  Values: `cpu`, `wait`, `block`, `gpu`, `mem`
- `sort` (enum · default: total) — optional
  The sort order for 'cpu' type

Supported values include:
  - `cpu`: Threads that consume the most CPU time.
  - `wait`: Threads that have been in a waiting state the longest.
  - `block`: Threads that have been blocked the longest.
  - `gpu`: Threads that consume the most GPU time.
  - `mem`: Threads that allocate the most memory.
  Values: `cpu`, `wait`, `block`, `gpu`, `mem`

## Response

`application/json`

Type: `object`

## Code examples

#### Console

```console
GET /_nodes/hot_threads
```

#### JavaScript

```javascript
const response = await client.nodes.hotThreads();
```

#### Python

```python
resp = client.nodes.hot_threads()
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_nodes/hot_threads" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.nodes().hotThreads(h -> h);
```

#### C#

```c#
var response = await client.Nodes.HotThreadsAsync();
```

#### PHP

```php
$resp = $client->nodes()->hotThreads();
```

#### Ruby

```ruby
response = client.nodes.hot_threads
```

