Type to search.

Run an ES|QL query

  • POST /_query
Auth The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Generally available since 8.11 This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

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

Read the reference documentation

Query parameters

format enum

A short version of the Accept header, e.g. json, yaml.

csv, tsv, and txt formats will return results in a tabular format, excluding other metadata fields from the response.

Values: csv json tsv txt yaml cbor smile arrow
delimiter string · default: ,

The character to use between values within a CSV row. Only valid for the CSV format.

drop_null_columns boolean · default: false

Should columns that are entirely null be removed from the columns and values portion of the results? Defaults to false. If true then the response will include an extra section under the name all_columns which has the name of all columns.

allow_partial_results boolean · default: true

If true, partial results will be returned if there are shard failures, but the query can continue to execute on other clusters and shards. If false, the query will fail if there are any failures.

To override the default behavior, you can set the esql.query.allow_partial_results cluster setting to false.

Request body

columnar boolean

By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results.

filter {} Query

Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on.

locale string
params union oneOf

To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters.

One of: union[] or object[]
profile boolean

If provided and true the response will include an extra profile object with information on how the query was executed. This information is for human debugging and its format can change at any time but it can give some insight into the performance of each part of the query.

query string required

The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results.

tables map string to string to object

Tables to use with the LOOKUP operation. The top level key is the table name and the next level key is the column name.

include_ccs_metadata boolean · default: false

When set to true and performing a cross-cluster query, the response will include an extra _clusters object with information about the clusters that participated in the search along with info such as shards count.

Response

application/json
took number
is_partial boolean
columns object[] required
name string required
type string required
values union oneOf[] required
One of: number or string or boolean or object
profile object

Profiling information. Present if profile was true in the request. The contents of this field are currently unstable.