﻿---
title: Find long-running ES|QL queries
description: You can list running ES|QL queries with the task management APIs: Which returns a list of statuses like this: You can use this to find long running queries...
url: https://www.elastic.co/elastic/docs-builder/docs/3028/reference/query-languages/esql/esql-task-management
products:
  - Elasticsearch
applies_to:
  - Elastic Cloud Serverless: Generally available
  - Elastic Stack: Generally available
---

# Find long-running ES|QL queries
You can list running ES|QL queries with the [task management APIs](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-tasks):

```json
```

Which returns a list of statuses like this:
```js
{
  "node" : "2j8UKw1bRO283PMwDugNNg",
  "id" : 5326,
  "type" : "transport",
  "action" : "indices:data/read/esql",
  "description" : "FROM test | STATS MAX(d) by a, b",  
  "start_time" : "2023-07-31T15:46:32.328Z",
  "start_time_in_millis" : 1690818392328,
  "running_time" : "41.7ms",                           
  "running_time_in_nanos" : 41770830,
  "cancellable" : true,
  "cancelled" : false,
  "headers" : { }
}
```

You can use this to find long running queries and, if you need to, cancel them with the [task cancellation API](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-tasks#task-cancellation):

```json
```

It may take a few seconds for the query to be stopped.