Skip to content

Add docs for async stop command #2181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions explore-analyze/query-filter/languages/esql-rest.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,24 @@ If the response’s `is_running` value is `false`, the query has finished and th
}
```

You can interrupt a running async query and collect the results that have been computed so far by using the [async stop API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-async-query-stop) with the query ID.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is GA in 9.0 right, so we don't need additional applies_to tags?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can interrupt a running async query and collect the results that have been computed so far by using the [async stop API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-async-query-stop) with the query ID.
To stop a running async query and return the results computed so far, use the [async stop API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-async-query-stop) with the query ID.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interrupt implies it can be resumed?


```console
POST /_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=/stop
```
The query will be stopped and the response will contain the results computed so far, in the same format as the `get` API.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The query will be stopped and the response will contain the results computed so far, in the same format as the `get` API.
The query will be stopped and the response will contain the results computed so far. The response format is the same as the `get` API.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sentence is a bit long


```console-result
{
"is_running": false,
"took": 48,
"is_partial": true,
"columns": ...
}
```
This API will also return the result of the query if it has finished before the stop request was made, within the `keep_alive` period.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit about the phrasing, I suggest "This API can be used to retrieve results even if the query has already completed, as long as it's within the keep_alive window."

You can use the `is_partial` field to determine if the results are complete or not. If `is_partial` is `true`, the results may be incomplete.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can use the `is_partial` field to determine if the results are complete or not. If `is_partial` is `true`, the results may be incomplete.
The `is_partial` field indicates result completeness. A value of `true` means the results are potentially incomplete.

Again just cutting sentence length.

I'd also like to be more precise here if possible, like what's the difference between partial and incomplete? The more explicit the better where possible.


Use the [{{esql}} async query delete API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-async-query-delete) to delete an async query before the `keep_alive` period ends. If the query is still running, {{es}} cancels it.

```console
Expand Down
Loading