elasticsearch/docs/reference/esql/esql-async-query-get-api.asciidoc
kanoshiou 67ee03411b
ESQL: Enable async get to support formatting (#111104)
I've updated the listener for GET /_query/async/{id} to EsqlResponseListener, so it now accepts parameters (delimiter, drop_null_columns and format) like the POST /_query API. Additionally, I have added tests to verify the correctness of the code.

You can now set the format in the request parameters to specify the return style.

Closes #110926
2024-12-09 13:08:48 +01:00

62 lines
2 KiB
Text

[[esql-async-query-get-api]]
=== {esql} async query get API
++++
<titleabbrev>{esql} async query get API</titleabbrev>
++++
Returns the current status and available results for an <<esql-async-query-api,{esql}
async query>> or a stored results.
[source,console]
----
GET /_query/async/FkpMRkJGS1gzVDRlM3g4ZzMyRGlLbkEaTXlJZHdNT09TU2VTZVBoNDM3cFZMUToxMDM=
----
// TEST[skip: no access to query ID]
[[esql-async-query-get-api-request]]
==== {api-request-title}
`GET /_query/async/<query_id>`
[[esql-async-query-get-api-prereqs]]
==== {api-prereq-title}
* If the {es} {security-features} are enabled, only the user who first submitted
the {esql} query can retrieve the results using this API.
[[esql-async-query-get-api-path-params]]
==== {api-path-parms-title}
`<query_id>`::
(Required, string)
Identifier for the query.
+
A query ID is provided in the <<esql-async-query-api,{esql} async query API>>'s
response for a query that does not complete in the awaited time. A query ID is
also provided if the request's <<esql-async-query-api-keep-on-completion,`keep_on_completion`>>
parameter is `true`.
[[esql-async-query-get-api-query-params]]
==== {api-query-parms-title}
The API accepts the same parameters as the synchronous
<<esql-query-api-query-params,query API>>, along with the following
parameters:
`wait_for_completion_timeout`::
(Optional, <<time-units,time value>>)
Timeout duration to wait for the request to finish. Defaults to no timeout,
meaning the request waits for complete query results.
+
If this parameter is specified and the request completes during this period,
complete query results are returned.
+
If the request does not complete during this period, the response returns an
`is_running` value of `true` and no results.
[[esql-async-query-get-api-response-body]]
==== {api-response-body-title}
The {esql} async query get API returns the same response body as the {esql}
query API. See the {esql} query API's <<esql-query-api-response-body,response
body parameters>>.