Run an ES|QL query

POST /_query

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

Query parameters

  • format string

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

    Values are csv, json, tsv, txt, yaml, cbor, smile, or arrow.

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

  • 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.

application/json

Body Required

Responses

  • 200 application/json

    Additional properties are allowed.

POST /_query
curl \
 -X POST http://api.example.com/_query \
 -H "Content-Type: application/json" \
 -d '"{\n  \"query\": \"\"\"\n    FROM library\n    | EVAL year = DATE_TRUNC(1 YEARS, release_date)\n    | STATS MAX(page_count) BY year\n    | SORT year\n    | LIMIT 5\n  \"\"\"\n}"'
Request example
{
  "query": """
    FROM library
    | EVAL year = DATE_TRUNC(1 YEARS, release_date)
    | STATS MAX(page_count) BY year
    | SORT year
    | LIMIT 5
  """
}