[[esql-task-management]]
== {esql} task management

++++
<titleabbrev>Task management</titleabbrev>
++++

You can list running {esql} queries with the <<tasks,task management API>>:

[source,console,id=esql-task-management-get-all]
----
GET /_tasks?pretty&detailed&group_by=parents&human&actions=*data/read/esql
----

Which returns a list of statuses like this:

[source,js]
----
include::{esql-specs}/query_task.json[]
----
// NOTCONSOLE
// Tested in a unit test

<1> The user submitted query.
<2> Time the query has been running.

You can use this to find long running queries and, if you need to, cancel them
with the <<task-cancellation, task cancellation API>>:

[source,console,id=esql-task-management-cancelEsqlQueryRequestTests]
----
POST _tasks/2j8UKw1bRO283PMwDugNNg:5326/_cancel
----

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