---
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/4371/api/doc/elasticsearch/v8/operation/operation-esql-async-query-stop
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v8/operation/operation-esql-async-query-stop
products:
  - Elasticsearch
---

# Stop async ES|QL query

Availability: 8.18+

## Paths

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

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

#### Path Parameters

- `id` (string Id)
  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.

[Read the reference documentation](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/esql.html)

## Query String Parameters

- `drop_null_columns` (boolean · default: false)
  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` (DurationValueUnitMillis)
- `is_partial` (boolean)
- `all_columns` ([] EsqlColumnInfo)
  - `name` (string)
  - `type` (string)
- `columns` ([] EsqlColumnInfo)
  - `name` (string)
  - `type` (string)
- `values` ([] union FieldValue)
  One of: `number` or `string` or `boolean` or `object`
- `_clusters` ({} EsqlClusterInfo)
  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 EsqlClusterDetails)
    Map values ({} EsqlClusterDetails)
    - `status` (enum EsqlClusterStatus)
      Values: `running`, `successful`, `partial`, `skipped`, `failed`
    - `indices` (string)
    - `took` (DurationValueUnitMillis)
    - `_shards` ({} EsqlShardInfo)
      - `total` (number)
      - `successful` (number)
      - `skipped` (number)
      - `failed` (number)
      - `failures` ([] EsqlShardFailure)
        - `shard` (string Id)
        - `index` (string IndexName)
        - `node` (string)
        - `reason` ({} ErrorCause)
          - `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` ({} ErrorCause) — recursive
            Same fields as `reason` in `failures`
          - `root_cause` ([] ErrorCause) — recursive
            Same fields as `reason` in `failures`
          - `suppressed` ([] ErrorCause) — 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="
)
```

