From 01bc0acd3d7477ecc95817673dcd70d04ca15225 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Fri, 18 Jul 2025 19:25:02 -0600 Subject: [PATCH 1/6] Add docs for async stop command --- .../query-filter/languages/esql-rest.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/explore-analyze/query-filter/languages/esql-rest.md b/explore-analyze/query-filter/languages/esql-rest.md index 3a6fd5ace5..8c5e4764bb 100644 --- a/explore-analyze/query-filter/languages/esql-rest.md +++ b/explore-analyze/query-filter/languages/esql-rest.md @@ -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. + +```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. + +```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. +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. + 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 From 16073812b4a22aa25a45e3af9762dda159c8431b Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Fri, 18 Jul 2025 19:28:43 -0600 Subject: [PATCH 2/6] fix json --- explore-analyze/query-filter/languages/esql-rest.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/explore-analyze/query-filter/languages/esql-rest.md b/explore-analyze/query-filter/languages/esql-rest.md index 8c5e4764bb..d7fe6ffa51 100644 --- a/explore-analyze/query-filter/languages/esql-rest.md +++ b/explore-analyze/query-filter/languages/esql-rest.md @@ -310,7 +310,7 @@ The query will be stopped and the response will contain the results computed so { "is_running": false, "took": 48, - is_partial: true, + "is_partial": true, "columns": ... } ``` From 073879b49a6466d20fc3f2a6b5c8f1ccbde40d02 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Mon, 21 Jul 2025 12:56:49 -0600 Subject: [PATCH 3/6] Update explore-analyze/query-filter/languages/esql-rest.md Co-authored-by: Liam Thompson --- explore-analyze/query-filter/languages/esql-rest.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/explore-analyze/query-filter/languages/esql-rest.md b/explore-analyze/query-filter/languages/esql-rest.md index d7fe6ffa51..77b690fa2d 100644 --- a/explore-analyze/query-filter/languages/esql-rest.md +++ b/explore-analyze/query-filter/languages/esql-rest.md @@ -304,7 +304,7 @@ You can interrupt a running async query and collect the results that have been c ```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. +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. ```console-result { From 7cb8a641f04f6d7c79c28400a8dff23b1daaba65 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Mon, 21 Jul 2025 12:57:06 -0600 Subject: [PATCH 4/6] Update explore-analyze/query-filter/languages/esql-rest.md Co-authored-by: Liam Thompson --- explore-analyze/query-filter/languages/esql-rest.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/explore-analyze/query-filter/languages/esql-rest.md b/explore-analyze/query-filter/languages/esql-rest.md index 77b690fa2d..9738f44cf2 100644 --- a/explore-analyze/query-filter/languages/esql-rest.md +++ b/explore-analyze/query-filter/languages/esql-rest.md @@ -315,7 +315,7 @@ The query will be stopped and the response will contain the results computed so } ``` 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. -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. 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. From 3c9036caea776eb45b0eb220d394d570bce8eeaf Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Mon, 21 Jul 2025 12:57:26 -0600 Subject: [PATCH 5/6] Update explore-analyze/query-filter/languages/esql-rest.md Co-authored-by: Liam Thompson --- explore-analyze/query-filter/languages/esql-rest.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/explore-analyze/query-filter/languages/esql-rest.md b/explore-analyze/query-filter/languages/esql-rest.md index 9738f44cf2..2b114707e2 100644 --- a/explore-analyze/query-filter/languages/esql-rest.md +++ b/explore-analyze/query-filter/languages/esql-rest.md @@ -299,7 +299,7 @@ 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. +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. ```console POST /_query/async/FmNJRUZ1YWZCU3dHY1BIOUhaenVSRkEaaXFlZ3h4c1RTWFNocDdnY2FSaERnUTozNDE=/stop From 10c451db3944e5741b6d3994f7624cc874027114 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Mon, 21 Jul 2025 12:58:28 -0600 Subject: [PATCH 6/6] Update esql-rest.md --- explore-analyze/query-filter/languages/esql-rest.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/explore-analyze/query-filter/languages/esql-rest.md b/explore-analyze/query-filter/languages/esql-rest.md index 2b114707e2..ce8c3134d4 100644 --- a/explore-analyze/query-filter/languages/esql-rest.md +++ b/explore-analyze/query-filter/languages/esql-rest.md @@ -314,7 +314,7 @@ The query will be stopped and the response will contain the results computed so "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. +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. The `is_partial` field indicates result completeness. A value of `true` means the results are potentially incomplete. 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.