[[reference-esql]]
== client.esql

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////
++++
<style>
.lang-ts a.xref {
  text-decoration: underline !important;
}
</style>
++++


[discrete]
[[client.esql.asyncQuery]]
== `client.esql.asyncQuery()`

Executes an ESQL request asynchronously

{ref}/esql-async-query-api.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: EsqlAsyncQueryRequest, options?: TransportRequestOptions) => Promise<EsqlAsyncQueryResponse>
----

[discrete]
[[client.esql.asyncQueryGet]]
== `client.esql.asyncQueryGet()`

Retrieves the results of a previously submitted async query request given its ID.

{ref}/esql-async-query-get-api.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: EsqlAsyncQueryGetRequest, options?: TransportRequestOptions) => Promise<EsqlAsyncQueryGetResponse>
----

[discrete]
[[client.esql.query]]
== `client.esql.query()`

Run an ES|QL query. Get search results for an ES|QL (Elasticsearch query language) query.

{ref}/esql-rest.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: EsqlQueryRequest, options?: TransportRequestOptions) => Promise<EsqlQueryResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface EsqlQueryRequest extends <<RequestBase>> {
  format?: EsqlQueryEsqlFormat
  delimiter?: string
  drop_null_columns?: boolean
  columnar?: boolean
  filter?: <<QueryDslQueryContainer>>
  locale?: string
  params?: <<FieldValue>>[]
  profile?: boolean
  query: string
  tables?: Record<string, Record<string, <<EsqlTableValuesContainer>>>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type EsqlQueryResponse = <<EsqlColumns>>

----


