---
type: api
title: Stop async ES|QL query
description: This API interrupts the query execution and returns the results so far.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v9/operation/operation-esql-async-query-stop
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v9/operation/operation-esql-async-query-stop
products:
  - Elasticsearch
---

# Stop async ES|QL query

Availability: Generally available since 8.18

## Paths

- `POST` `/_query/async/{id}/stop`

#### Path parameters

- `id` (string) — required
  The unique identifier of the query.
A query ID is provided in the ES|QL async query API response for a query that does not complete in the designated time.
A query ID is also provided when the request was submitted with the `keep_on_completion` parameter set to `true`.

## Description

This API interrupts the query execution and returns the results so far.
If the Elasticsearch security features are enabled, only the user who first submitted the ES|QL query can stop it.

[More about ES|QL reference](https://www.elastic.co/docs/explore-analyze/query-filter/languages/esql)

## Required authorization

- Index privileges: `read`

## 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

- `drop_null_columns` (boolean · default: false) — optional
  Indicates whether columns that are entirely `null` will be removed from the `columns` and `values` portion of the results.
If `true`, the response will include an extra section under the name `all_columns` which has the name of all the columns.

## Response

`application/json`

- `took` (number)
- `is_partial` (boolean)
- `all_columns` (object[])
  - `name` (string)
  - `type` (string)
- `columns` (object[])
  - `name` (string)
  - `type` (string)
- `values` (union oneOf[])
  One of: `number` or `string` or `boolean`
- `_clusters` (object)
  Cross-cluster search information. Present if `include_ccs_metadata` was `true` in the request
and a cross-cluster search was performed.
  - `total` (number)
  - `successful` (number)
  - `running` (number)
  - `skipped` (number)
  - `partial` (number)
  - `failed` (number)
  - `details` (map string to object)
    Map values (object)
    - `status` (enum)
      Values: `running`, `successful`, `partial`, `skipped`, `failed`
    - `indices` (string)
    - `took` (number)
    - `_shards` (object)
      - `total` (number)
      - `successful` (number)
      - `skipped` (number)
      - `failed` (number)
    - `failures` (object[])
      - `shard` (number)
      - `index` (union string) — nullable
      - `node` (string)
      - `reason` (object)
        - `type` (string)
          The type of error
        - `reason` (union string) — nullable
          A human-readable explanation of the error, in English.
          One of: `string`
        - `stack_trace` (string)
          The server stack trace. Present only if the `error_trace=true` parameter was sent with the request.
        - `caused_by` (object) — recursive
          Same fields as `reason` in `failures`
        - `root_cause` (object[]) — recursive
          Same fields as `reason` in `failures`
        - `suppressed` (object[]) — recursive
          Same fields as `reason` in `failures`
- `profile` (object)
  Profiling information. Present if `profile` was `true` in the request.
The contents of this field are currently unstable.
## Code examples

#### Console

```console
POST /_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=/stop
```

#### JavaScript

```javascript
const response = await client.esql.asyncQueryStop({
  id: "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
});
```

#### Python

```python
resp = client.esql.async_query_stop(
    id="FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
)
```

#### curl

```curl
curl -X POST "$ELASTICSEARCH_URL/_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=/stop" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### C#

```c#
var response = await client.Esql.AsyncQueryStopAsync(id: "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=");
```

#### PHP

```php
$resp = $client->esql()->asyncQueryStop([
    "id" => "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=",
]);
```

#### Ruby

```ruby
response = client.esql.async_query_stop(
  id: "FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM="
)
```

