Query parameters
-
The format for the response. You can also specify a format using the
Accept
HTTP header. If you specify both this parameter and theAccept
HTTP header, this parameter takes precedence.Values are
csv
,json
,tsv
,txt
,yaml
,cbor
, orsmile
.
Body
Required
-
If
true
, the response has partial results when there are shard request timeouts or shard failures. Iffalse
, the API returns an error with no partial results. -
The default catalog (cluster) for queries. If unspecified, the queries execute on the data in the local cluster only.
-
If
true
, the results are in a columnar fashion: one row represents all the values of a certain column from the current page of results. The API supports this parameter only for CBOR, JSON, SMILE, and YAML responses.External documentation -
The cursor used to retrieve a set of paginated results. If you specify a cursor, the API only uses the
columnar
andtime_zone
request body parameters. It ignores other request body parameters. -
The maximum number of rows (or entries) to return in one response.
-
If
false
, the API returns an exception when encountering multiple values for a field. Iftrue
, the API is lenient and returns the first value from the array with no guarantee of consistent results. -
An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
External documentation -
If
true
, the search can run on frozen indices. -
A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
If
true
, Elasticsearch stores synchronous searches if you also specify thewait_for_completion_timeout
parameter. Iffalse
, Elasticsearch only stores async searches that don't finish before thewait_for_completion_timeout
. -
A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
The values for parameters in the query.
-
The SQL query to run.
External documentation -
A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. -
A duration. Units can be
nanos
,micros
,ms
(milliseconds),s
(seconds),m
(minutes),h
(hours) andd
(days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
POST _sql?format=txt
{
"query": "SELECT * FROM library ORDER BY page_count DESC LIMIT 5"
}
curl \
--request POST 'http://api.example.com/_sql' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"query\": \"SELECT * FROM library ORDER BY page_count DESC LIMIT 5\"\n}"'
{
"query": "SELECT * FROM library ORDER BY page_count DESC LIMIT 5"
}