---
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/4371/api/doc/elasticsearch/v9/operation/operation-nodes-hot-threads
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-nodes-hot-threads
products:
  - Elasticsearch
---

# Get the hot threads for nodes


Availability:

## Paths

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

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#bearerauth)

#### Path Parameters

- `node_id` (union NodeId | [] NodeId) — 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`

## Query String Parameters

- `ignore_idle_threads` (boolean · default: true)
  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 Duration · default: 500ms)
  The interval to do the second sampling of threads.
- `snapshots` (number · default: 10)
  Number of samples of thread stacktrace.
- `threads` (number · default: 3)
  Specifies the number of hot threads to provide information for.
- `timeout` (string Duration · default: 30s)
  Period to wait for a response. If no response is received
before the timeout expires, the request fails and returns an error.
- `type` (enum ThreadType · default: cpu)
  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 ThreadType · default: total)
  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
```

