Executes a SQL request Added in 6.3.0
Query parameters
-
format string
Format for the response.
Values are
csv
,json
,tsv
,txt
,yaml
,cbor
, orsmile
.
Body Required
-
catalog string
Default catalog (cluster) for queries. If unspecified, the queries execute on the data in the local cluster only.
-
columnar boolean
If true, the results in a columnar fashion: one row represents all the values of a certain column from the current page of results.
-
cursor string
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. -
fetch_size number
The maximum number of rows (or entries) to return in one response
-
filter object
Additional properties are allowed.
-
query string
SQL query to run.
-
request_timeout string
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. -
page_timeout string
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. -
time_zone string
-
field_multi_value_leniency boolean
Throw an exception when encountering multiple values for a field (default) or be lenient and return the first value from the list (without any guarantees of what that will be - typically the first in natural ascending order).
-
runtime_mappings object
-
wait_for_completion_timeout string
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. -
params object
Values for parameters in the query.
-
keep_alive string
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. -
keep_on_completion boolean
If true, Elasticsearch stores synchronous searches if you also specify the wait_for_completion_timeout parameter. If false, Elasticsearch only stores async searches that don’t finish before the wait_for_completion_timeout.
-
index_using_frozen boolean
If true, the search can run on frozen indices. Defaults to false.
curl \
-X POST http://api.example.com/_sql \
-H "Content-Type: application/json" \
-d '{"catalog":"string","columnar":true,"cursor":"string","fetch_size":42.0,"filter":{},"query":"string","request_timeout":"string","page_timeout":"string","time_zone":"string","field_multi_value_leniency":true,"runtime_mappings":{"additionalProperty1":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"},"additionalProperty2":{"fields":{"additionalProperty1":{"type":"boolean"},"additionalProperty2":{"type":"boolean"}},"fetch_fields":[{"field":"string","format":"string"}],"format":"string","input_field":"string","target_field":"string","target_index":"string","script":{"source":"string","id":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"":"painless","options":{"additionalProperty1":"string","additionalProperty2":"string"}},"type":"boolean"}},"wait_for_completion_timeout":"string","params":{"additionalProperty1":{},"additionalProperty2":{}},"keep_alive":"string","keep_on_completion":true,"index_using_frozen":true}'