Translate SQL into Elasticsearch queries

  • POST also GET /_sql/translate
Auth

Translate an SQL search into a search API request containing Query DSL. It accepts the same request body parameters as the SQL search API, excluding cursor.

Required authorization

Index privileges read

Request body

fetch_size number · default: 1000

The maximum number of rows (or entries) to return in one response.

filter {} Query · default: none

The Elasticsearch query DSL for additional filtering.

query string required

The SQL query to run.

time_zone string · default: Z

The ISO-8601 time zone ID for the search.

Response

application/json
aggregations map string to {} Aggregation
size number
_source union oneOf
One of:
fields object[]
field string required

A wildcard pattern. The request returns values for field names matching this pattern.

format string

The format in which the values are returned.

include_unmapped boolean
query {} Query
sort union oneOf
A value or an array; each item is one of:

Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.

track_total_hits boolean | number