rest.asciidoc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[sql-rest]]
  4. == SQL REST API
  5. * <<sql-rest-overview>>
  6. * <<sql-rest-format>>
  7. * <<sql-pagination>>
  8. * <<sql-rest-filtering>>
  9. * <<sql-rest-columnar>>
  10. * <<sql-rest-params>>
  11. * <<sql-rest-fields>>
  12. [[sql-rest-overview]]
  13. === Overview
  14. The SQL REST API accepts SQL in a JSON document, executes it,
  15. and returns the results.
  16. For example:
  17. [source,console]
  18. --------------------------------------------------
  19. POST /_sql?format=txt
  20. {
  21. "query": "SELECT * FROM library ORDER BY page_count DESC LIMIT 5"
  22. }
  23. --------------------------------------------------
  24. // TEST[setup:library]
  25. Which returns:
  26. [source,text]
  27. --------------------------------------------------
  28. author | name | page_count | release_date
  29. -----------------+--------------------+---------------+------------------------
  30. Peter F. Hamilton|Pandora's Star |768 |2004-03-02T00:00:00.000Z
  31. Vernor Vinge |A Fire Upon the Deep|613 |1992-06-01T00:00:00.000Z
  32. Frank Herbert |Dune |604 |1965-06-01T00:00:00.000Z
  33. Alastair Reynolds|Revelation Space |585 |2000-03-15T00:00:00.000Z
  34. James S.A. Corey |Leviathan Wakes |561 |2011-06-02T00:00:00.000Z
  35. --------------------------------------------------
  36. // TESTRESPONSE[s/\|/\\|/ s/\+/\\+/]
  37. // TESTRESPONSE[non_json]
  38. [[sql-kibana-console]]
  39. [TIP]
  40. .Using Kibana Console
  41. ====
  42. If you are using {kibana-ref}/console-kibana.html[Kibana Console]
  43. (which is highly recommended), take advantage of the
  44. triple quotes `"""` when creating the query. This not only automatically escapes double
  45. quotes (`"`) inside the query string but also support multi-line as shown below:
  46. image:images/sql/rest/console-triple-quotes.png[]
  47. ====
  48. [[sql-rest-format]]
  49. === Response Data Formats
  50. While the textual format is nice for humans, computers prefer something
  51. more structured.
  52. {es-sql} can return the data in the following formats which can be set
  53. either through the `format` property in the URL or by setting the `Accept` HTTP header:
  54. NOTE: The URL parameter takes precedence over the `Accept` HTTP header.
  55. If neither is specified then the response is returned in the same format as the request.
  56. [cols="^m,^4m,^8"]
  57. |===
  58. s|format
  59. s|`Accept` HTTP header
  60. s|Description
  61. 3+h| Human Readable
  62. |csv
  63. |text/csv
  64. |https://en.wikipedia.org/wiki/Comma-separated_values[Comma-separated values]
  65. |json
  66. |application/json
  67. |https://www.json.org/[JSON] (JavaScript Object Notation) human-readable format
  68. |tsv
  69. |text/tab-separated-values
  70. |https://en.wikipedia.org/wiki/Tab-separated_values[Tab-separated values]
  71. |txt
  72. |text/plain
  73. |CLI-like representation
  74. |yaml
  75. |application/yaml
  76. |https://en.wikipedia.org/wiki/YAML[YAML] (YAML Ain't Markup Language) human-readable format
  77. 3+h| Binary Formats
  78. |cbor
  79. |application/cbor
  80. |http://cbor.io/[Concise Binary Object Representation]
  81. |smile
  82. |application/smile
  83. |https://en.wikipedia.org/wiki/Smile_(data_interchange_format)[Smile] binary data format similar to CBOR
  84. |===
  85. Here are some examples for the human readable formats:
  86. ==== CSV
  87. [source,console]
  88. --------------------------------------------------
  89. POST /_sql?format=csv
  90. {
  91. "query": "SELECT * FROM library ORDER BY page_count DESC",
  92. "fetch_size": 5
  93. }
  94. --------------------------------------------------
  95. // TEST[setup:library]
  96. Which returns:
  97. [source,text]
  98. --------------------------------------------------
  99. author,name,page_count,release_date
  100. Peter F. Hamilton,Pandora's Star,768,2004-03-02T00:00:00.000Z
  101. Vernor Vinge,A Fire Upon the Deep,613,1992-06-01T00:00:00.000Z
  102. Frank Herbert,Dune,604,1965-06-01T00:00:00.000Z
  103. Alastair Reynolds,Revelation Space,585,2000-03-15T00:00:00.000Z
  104. James S.A. Corey,Leviathan Wakes,561,2011-06-02T00:00:00.000Z
  105. --------------------------------------------------
  106. // TESTRESPONSE[non_json]
  107. ==== JSON
  108. [source,console]
  109. --------------------------------------------------
  110. POST /_sql?format=json
  111. {
  112. "query": "SELECT * FROM library ORDER BY page_count DESC",
  113. "fetch_size": 5
  114. }
  115. --------------------------------------------------
  116. // TEST[setup:library]
  117. Which returns:
  118. [source,console-result]
  119. --------------------------------------------------
  120. {
  121. "columns": [
  122. {"name": "author", "type": "text"},
  123. {"name": "name", "type": "text"},
  124. {"name": "page_count", "type": "short"},
  125. {"name": "release_date", "type": "datetime"}
  126. ],
  127. "rows": [
  128. ["Peter F. Hamilton", "Pandora's Star", 768, "2004-03-02T00:00:00.000Z"],
  129. ["Vernor Vinge", "A Fire Upon the Deep", 613, "1992-06-01T00:00:00.000Z"],
  130. ["Frank Herbert", "Dune", 604, "1965-06-01T00:00:00.000Z"],
  131. ["Alastair Reynolds", "Revelation Space", 585, "2000-03-15T00:00:00.000Z"],
  132. ["James S.A. Corey", "Leviathan Wakes", 561, "2011-06-02T00:00:00.000Z"]
  133. ],
  134. "cursor": "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWWWdrRlVfSS1TbDYtcW9lc1FJNmlYdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl+v///w8="
  135. }
  136. --------------------------------------------------
  137. // TESTRESPONSE[s/sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWWWdrRlVfSS1TbDYtcW9lc1FJNmlYdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl\+v\/\/\/w8=/$body.cursor/]
  138. ==== TSV
  139. [source,console]
  140. --------------------------------------------------
  141. POST /_sql?format=tsv
  142. {
  143. "query": "SELECT * FROM library ORDER BY page_count DESC",
  144. "fetch_size": 5
  145. }
  146. --------------------------------------------------
  147. // TEST[setup:library]
  148. Which returns:
  149. [source,text]
  150. --------------------------------------------------
  151. author name page_count release_date
  152. Peter F. Hamilton Pandora's Star 768 2004-03-02T00:00:00.000Z
  153. Vernor Vinge A Fire Upon the Deep 613 1992-06-01T00:00:00.000Z
  154. Frank Herbert Dune 604 1965-06-01T00:00:00.000Z
  155. Alastair Reynolds Revelation Space 585 2000-03-15T00:00:00.000Z
  156. James S.A. Corey Leviathan Wakes 561 2011-06-02T00:00:00.000Z
  157. --------------------------------------------------
  158. // TESTRESPONSE[s/\t/ /]
  159. // TESTRESPONSE[non_json]
  160. ==== TXT
  161. [source,console]
  162. --------------------------------------------------
  163. POST /_sql?format=txt
  164. {
  165. "query": "SELECT * FROM library ORDER BY page_count DESC",
  166. "fetch_size": 5
  167. }
  168. --------------------------------------------------
  169. // TEST[setup:library]
  170. Which returns:
  171. [source,text]
  172. --------------------------------------------------
  173. author | name | page_count | release_date
  174. -----------------+--------------------+---------------+------------------------
  175. Peter F. Hamilton|Pandora's Star |768 |2004-03-02T00:00:00.000Z
  176. Vernor Vinge |A Fire Upon the Deep|613 |1992-06-01T00:00:00.000Z
  177. Frank Herbert |Dune |604 |1965-06-01T00:00:00.000Z
  178. Alastair Reynolds|Revelation Space |585 |2000-03-15T00:00:00.000Z
  179. James S.A. Corey |Leviathan Wakes |561 |2011-06-02T00:00:00.000Z
  180. --------------------------------------------------
  181. // TESTRESPONSE[s/\|/\\|/ s/\+/\\+/]
  182. // TESTRESPONSE[non_json]
  183. ==== YAML
  184. [source,console]
  185. --------------------------------------------------
  186. POST /_sql?format=yaml
  187. {
  188. "query": "SELECT * FROM library ORDER BY page_count DESC",
  189. "fetch_size": 5
  190. }
  191. --------------------------------------------------
  192. // TEST[setup:library]
  193. Which returns:
  194. [source,yaml]
  195. --------------------------------------------------
  196. columns:
  197. - name: "author"
  198. type: "text"
  199. - name: "name"
  200. type: "text"
  201. - name: "page_count"
  202. type: "short"
  203. - name: "release_date"
  204. type: "datetime"
  205. rows:
  206. - - "Peter F. Hamilton"
  207. - "Pandora's Star"
  208. - 768
  209. - "2004-03-02T00:00:00.000Z"
  210. - - "Vernor Vinge"
  211. - "A Fire Upon the Deep"
  212. - 613
  213. - "1992-06-01T00:00:00.000Z"
  214. - - "Frank Herbert"
  215. - "Dune"
  216. - 604
  217. - "1965-06-01T00:00:00.000Z"
  218. - - "Alastair Reynolds"
  219. - "Revelation Space"
  220. - 585
  221. - "2000-03-15T00:00:00.000Z"
  222. - - "James S.A. Corey"
  223. - "Leviathan Wakes"
  224. - 561
  225. - "2011-06-02T00:00:00.000Z"
  226. cursor: "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWWWdrRlVfSS1TbDYtcW9lc1FJNmlYdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl+v///w8="
  227. --------------------------------------------------
  228. // TESTRESPONSE[s/sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWWWdrRlVfSS1TbDYtcW9lc1FJNmlYdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl\+v\/\/\/w8=/$body.cursor/]
  229. [[sql-pagination]]
  230. === Paginating through a large response
  231. Using the example from the <<sql-rest-format,previous section>>, one can
  232. continue to the next page by sending back the cursor field. In case of text
  233. format, the cursor is returned as `Cursor` http header.
  234. [source,console]
  235. --------------------------------------------------
  236. POST /_sql?format=json
  237. {
  238. "cursor": "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8="
  239. }
  240. --------------------------------------------------
  241. // TEST[continued]
  242. // TEST[s/sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f\/\/\/w8=/$body.cursor/]
  243. Which looks like:
  244. [source,console-result]
  245. --------------------------------------------------
  246. {
  247. "rows" : [
  248. ["Dan Simmons", "Hyperion", 482, "1989-05-26T00:00:00.000Z"],
  249. ["Iain M. Banks", "Consider Phlebas", 471, "1987-04-23T00:00:00.000Z"],
  250. ["Neal Stephenson", "Snow Crash", 470, "1992-06-01T00:00:00.000Z"],
  251. ["Frank Herbert", "God Emperor of Dune", 454, "1981-05-28T00:00:00.000Z"],
  252. ["Frank Herbert", "Children of Dune", 408, "1976-04-21T00:00:00.000Z"]
  253. ],
  254. "cursor" : "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWODRMaXBUaVlRN21iTlRyWHZWYUdrdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl9f///w8="
  255. }
  256. --------------------------------------------------
  257. // TESTRESPONSE[s/sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWODRMaXBUaVlRN21iTlRyWHZWYUdrdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl9f\/\/\/w8=/$body.cursor/]
  258. Note that the `columns` object is only part of the first page.
  259. You've reached the last page when there is no `cursor` returned
  260. in the results. Like Elasticsearch's <<request-body-search-scroll,scroll>>,
  261. SQL may keep state in Elasticsearch to support the cursor. Unlike
  262. scroll, receiving the last page is enough to guarantee that the
  263. Elasticsearch state is cleared.
  264. To clear the state earlier, you can use the clear cursor command:
  265. [source,console]
  266. --------------------------------------------------
  267. POST /_sql/close
  268. {
  269. "cursor": "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f///w8="
  270. }
  271. --------------------------------------------------
  272. // TEST[continued]
  273. // TEST[s/sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWYUpOYklQMHhRUEtld3RsNnFtYU1hQQ==:BAFmBGRhdGUBZgVsaWtlcwFzB21lc3NhZ2UBZgR1c2Vy9f\/\/\/w8=/$body.cursor/]
  274. Which will like return the
  275. [source,console-result]
  276. --------------------------------------------------
  277. {
  278. "succeeded" : true
  279. }
  280. --------------------------------------------------
  281. [[sql-rest-filtering]]
  282. === Filtering using {es} query DSL
  283. One can filter the results that SQL will run on using a standard
  284. {es} query DSL by specifying the query in the filter
  285. parameter.
  286. [source,console]
  287. --------------------------------------------------
  288. POST /_sql?format=txt
  289. {
  290. "query": "SELECT * FROM library ORDER BY page_count DESC",
  291. "filter": {
  292. "range": {
  293. "page_count": {
  294. "gte" : 100,
  295. "lte" : 200
  296. }
  297. }
  298. },
  299. "fetch_size": 5
  300. }
  301. --------------------------------------------------
  302. // TEST[setup:library]
  303. Which returns:
  304. [source,text]
  305. --------------------------------------------------
  306. author | name | page_count | release_date
  307. ---------------+------------------------------------+---------------+------------------------
  308. Douglas Adams |The Hitchhiker's Guide to the Galaxy|180 |1979-10-12T00:00:00.000Z
  309. --------------------------------------------------
  310. // TESTRESPONSE[s/\|/\\|/ s/\+/\\+/]
  311. // TESTRESPONSE[non_json]
  312. [TIP]
  313. =================
  314. A useful and less obvious usage for standard query DSL filtering is to search documents by a specific <<search-routing, routing key>>.
  315. Because {es-sql} does not support a `routing` parameter, one can specify a <<mapping-routing-field, `terms` filter for the `_routing` field>> instead:
  316. [source,console]
  317. --------------------------------------------------
  318. POST /_sql?format=txt
  319. {
  320. "query": "SELECT * FROM library",
  321. "filter": {
  322. "terms": {
  323. "_routing": ["abc"]
  324. }
  325. }
  326. }
  327. --------------------------------------------------
  328. // TEST[setup:library]
  329. =================
  330. [[sql-rest-columnar]]
  331. === Columnar results
  332. The most well known way of displaying the results of an SQL query result in general is the one where each
  333. individual record/document represents one line/row. For certain formats, {es-sql} can return the results
  334. in a columnar fashion: one row represents all the values of a certain column from the current page of results.
  335. The following formats can be returned in columnar orientation: `json`, `yaml`, `cbor` and `smile`.
  336. [source,console]
  337. --------------------------------------------------
  338. POST /_sql?format=json
  339. {
  340. "query": "SELECT * FROM library ORDER BY page_count DESC",
  341. "fetch_size": 5,
  342. "columnar": true
  343. }
  344. --------------------------------------------------
  345. // TEST[setup:library]
  346. Which returns:
  347. [source,console-result]
  348. --------------------------------------------------
  349. {
  350. "columns": [
  351. {"name": "author", "type": "text"},
  352. {"name": "name", "type": "text"},
  353. {"name": "page_count", "type": "short"},
  354. {"name": "release_date", "type": "datetime"}
  355. ],
  356. "values": [
  357. ["Peter F. Hamilton", "Vernor Vinge", "Frank Herbert", "Alastair Reynolds", "James S.A. Corey"],
  358. ["Pandora's Star", "A Fire Upon the Deep", "Dune", "Revelation Space", "Leviathan Wakes"],
  359. [768, 613, 604, 585, 561],
  360. ["2004-03-02T00:00:00.000Z", "1992-06-01T00:00:00.000Z", "1965-06-01T00:00:00.000Z", "2000-03-15T00:00:00.000Z", "2011-06-02T00:00:00.000Z"]
  361. ],
  362. "cursor": "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWWWdrRlVfSS1TbDYtcW9lc1FJNmlYdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl+v///w8="
  363. }
  364. --------------------------------------------------
  365. // TESTRESPONSE[s/sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWWWdrRlVfSS1TbDYtcW9lc1FJNmlYdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl\+v\/\/\/w8=/$body.cursor/]
  366. Any subsequent calls using a `cursor` still have to contain the `columnar` parameter to preserve the orientation,
  367. meaning the initial query will not _remember_ the columnar option.
  368. [source,console]
  369. --------------------------------------------------
  370. POST /_sql?format=json
  371. {
  372. "cursor": "sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWWWdrRlVfSS1TbDYtcW9lc1FJNmlYdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl+v///w8=",
  373. "columnar": true
  374. }
  375. --------------------------------------------------
  376. // TEST[continued]
  377. // TEST[s/sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWWWdrRlVfSS1TbDYtcW9lc1FJNmlYdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl\+v\/\/\/w8=/$body.cursor/]
  378. Which looks like:
  379. [source,console-result]
  380. --------------------------------------------------
  381. {
  382. "values": [
  383. ["Dan Simmons", "Iain M. Banks", "Neal Stephenson", "Frank Herbert", "Frank Herbert"],
  384. ["Hyperion", "Consider Phlebas", "Snow Crash", "God Emperor of Dune", "Children of Dune"],
  385. [482, 471, 470, 454, 408],
  386. ["1989-05-26T00:00:00.000Z", "1987-04-23T00:00:00.000Z", "1992-06-01T00:00:00.000Z", "1981-05-28T00:00:00.000Z", "1976-04-21T00:00:00.000Z"]
  387. ],
  388. "cursor": "46ToAwFzQERYRjFaWEo1UVc1a1JtVjBZMmdCQUFBQUFBQUFBQUVXWjBaNlFXbzNOV0pVY21Wa1NUZDJhV2t3V2xwblp3PT3/////DwQBZgZhdXRob3IBBHRleHQAAAFmBG5hbWUBBHRleHQAAAFmCnBhZ2VfY291bnQBBGxvbmcBAAFmDHJlbGVhc2VfZGF0ZQEIZGF0ZXRpbWUBAAEP"
  389. }
  390. --------------------------------------------------
  391. // TESTRESPONSE[s/46ToAwFzQERYRjFaWEo1UVc1a1JtVjBZMmdCQUFBQUFBQUFBQUVXWjBaNlFXbzNOV0pVY21Wa1NUZDJhV2t3V2xwblp3PT3\/\/\/\/\/DwQBZgZhdXRob3IBBHRleHQAAAFmBG5hbWUBBHRleHQAAAFmCnBhZ2VfY291bnQBBGxvbmcBAAFmDHJlbGVhc2VfZGF0ZQEIZGF0ZXRpbWUBAAEP/$body.cursor/]
  392. [[sql-rest-params]]
  393. === Passing parameters to a query
  394. Using values in a query condition, for example, or in a `HAVING` statement can be done "inline",
  395. by integrating the value in the query string itself:
  396. [source,console]
  397. --------------------------------------------------
  398. POST /_sql?format=txt
  399. {
  400. "query": "SELECT YEAR(release_date) AS year FROM library WHERE page_count > 300 AND author = 'Frank Herbert' GROUP BY year HAVING COUNT(*) > 0"
  401. }
  402. --------------------------------------------------
  403. // TEST[setup:library]
  404. or it can be done by extracting the values in a separate list of parameters and using question mark placeholders (`?`) in the query string:
  405. [source,console]
  406. --------------------------------------------------
  407. POST /_sql?format=txt
  408. {
  409. "query": "SELECT YEAR(release_date) AS year FROM library WHERE page_count > ? AND author = ? GROUP BY year HAVING COUNT(*) > ?",
  410. "params": [300, "Frank Herbert", 0]
  411. }
  412. --------------------------------------------------
  413. // TEST[setup:library]
  414. [IMPORTANT]
  415. The recommended way of passing values to a query is with question mark placeholders, to avoid any attempts of hacking or SQL injection.
  416. [[sql-rest-fields]]
  417. === Supported REST parameters
  418. In addition to the `query` and `fetch_size`, a request a number of user-defined fields for specifying
  419. the request time-outs or localization information (such as timezone).
  420. The table below lists the supported parameters:
  421. [cols="^m,^m,^5"]
  422. |===
  423. s|name
  424. s|Default value
  425. s|Description
  426. |query
  427. |Mandatory
  428. |SQL query to execute
  429. |fetch_size
  430. |1000
  431. |The maximum number of rows (or entries) to return in one response
  432. |filter
  433. |none
  434. |Optional {es} query DSL for additional <<sql-rest-filtering, filtering>>.
  435. |request_timeout
  436. |90s
  437. |The timeout before the request fails.
  438. |page_timeout
  439. |45s
  440. |The timeout before a pagination request fails.
  441. |time_zone
  442. |`Z` (or `UTC`)
  443. |Time-zone in ISO 8601 used for executing the query on the server.
  444. More information available https://docs.oracle.com/javase/8/docs/api/java/time/ZoneId.html[here].
  445. |columnar
  446. |false
  447. |Return the results in a columnar fashion, rather than row-based fashion. Valid for `json`, `yaml`, `cbor` and `smile`.
  448. |field_multi_value_leniency
  449. |false
  450. |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).
  451. |index_include_frozen
  452. |false
  453. |Whether to include <<frozen-indices, frozen-indices>> in the query execution or not (default).
  454. |params
  455. |none
  456. |Optional list of parameters to replace question mark (`?`) placeholders inside the query.
  457. |===
  458. Do note that most parameters (outside the timeout and `columnar` ones) make sense only during the initial query - any follow-up pagination request only requires the `cursor` parameter as explained in the <<sql-pagination, pagination>> chapter.
  459. That's because the query has already been executed and the calls are simply about returning the found results - thus the parameters are simply ignored.