From 79bc6aba79fc2d98f38e8f4d4695a93346b1fd40 Mon Sep 17 00:00:00 2001 From: Costin Leau Date: Fri, 15 Feb 2019 21:15:40 +0200 Subject: [PATCH] SQL: Polish the rest chapter (#38971) Organize the text a bit and add tip on triple quotes in Kibana Console --- .../images/sql/rest/console-triple-quotes.png | Bin 0 -> 54729 bytes docs/reference/sql/endpoints/rest.asciidoc | 141 +++++++++++++++--- .../sql/endpoints/translate.asciidoc | 2 +- 3 files changed, 118 insertions(+), 25 deletions(-) create mode 100644 docs/reference/images/sql/rest/console-triple-quotes.png diff --git a/docs/reference/images/sql/rest/console-triple-quotes.png b/docs/reference/images/sql/rest/console-triple-quotes.png new file mode 100644 index 0000000000000000000000000000000000000000..c689b5902b580f334a640fe44bea641c1c5ae5c6 GIT binary patch literal 54729 zcmeG_cOaJE_s?r5B0DM?GD9KRugb{Ydo_^ktn9avL}rOHOR^<eFZbzMl{G5AS{MJ@?#m&U5d%=bn4+q`KFth@feO4 z5<8Kb#D|(Z=p1#z)b=;R`pq2f2j3jMOCN&WGv|3mq%PF}BUC9{%wvo6Qx5r0WRj{P zaf*x?F=~VD$Q>tH+8hMmE!EFzQNJ(;R0d9FMdYVrlUNQ*sg z1?^WPj7>c9iqZ!TMi8JQ-5~iF%i}AG>tfkkIijO>cG6qcu>Pim{km=^Auwm@QJv)_ zR+D5wx~3leL3^r0c$C#VNpX#UYxpQ*Y%hl$oGr0gQ;y#9zm)G@X2!C+OSd_lo@56n zB^TAqyAW@5CKqQDKa97Z>+WE{=E=efWTZTyH$=Wm8URvlqCefE06_;@+_hSOQgfA# zF`kBD;w%jG<^TYH5bLI`7xGE{%tjox@SV%jFw}cPrxo$eNUF~`?r8VC9J-LiMDshu zu>H))*pe{ll87_1wrHYjQ*=;3o~qu3spcqeJTDdi&;9W3)%I4lTW6)4nrX(D3 z0gZ!O-m(!p9}gWnnT1uiA0u;nGNJ8m(~YuwLM>#PEp6>YYXthu z13~z!R)#V40}ps}t=hX|fgMm2WK!=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docs/reference/sql/endpoints/rest.asciidoc +++ b/docs/reference/sql/endpoints/rest.asciidoc @@ -4,8 +4,8 @@ == SQL REST API The SQL REST API accepts SQL in a JSON document, executes it, -and returns the results. For example: - +and returns the results. +For example: [source,js] -------------------------------------------------- @@ -32,19 +32,68 @@ James S.A. Corey |Leviathan Wakes |561 |2011-06-02T00:00:00.000Z // TESTRESPONSE[s/\|/\\|/ s/\+/\\+/] // TESTRESPONSE[_cat] -While the `text/plain` format is nice for humans, computers prefer something -more structured. You can replace the value of `format` with: -- `json` aka `application/json` -- `yaml` aka `application/yaml` -- `smile` aka `application/smile` -- `cbor` aka `application/cbor` -- `txt` aka `text/plain` -- `csv` aka `text/csv` -- `tsv` aka `text/tab-separated-values` +[[sql-kibana-console]] +.Using Kibana Console +If you are using {kibana-ref}/console-kibana.html[Kibana Console]. +(which is highly recommended), take advantage of the +triple quotes `"""` when creating the query. This not only automatically escapes double +quotes (`"`) inside the query string but also support multi-line as shown below: +image:images/sql/rest/console-triple-quotes.png[] + +[[sql-rest-format]] +[float] +=== Response Data Formats + +While the textual format is nice for humans, computers prefer something +more structured. + +{es-sql} can return the data in the following formats which can be set +either through the `format` property in the URL or by setting the `Accept` HTTP header: + +NOTE: The URL parameter takes precedence over the `Accept` HTTP header. +If neither is specified then the response is returned in the same format as the request. + +[cols="^m,^4m,^8"] + +|=== +s|format +s|`Accept` HTTP header +s|Description + +3+h| Human Readable + +|csv +|text/csv +|https://en.wikipedia.org/wiki/Comma-separated_values[Comma-separated values] + +|json +|application/json +|https://www.json.org/[JSON] (JavaScript Object Notation) human-readable format + +|tsv +|text/tab-separated-values +|https://en.wikipedia.org/wiki/Tab-separated_values[Tab-separated values] + +|txt +|text/plain +|CLI-like representation + +|yaml +|application/yaml +|https://en.wikipedia.org/wiki/YAML[YAML] (YAML Ain't Markup Language) human-readable format + +3+h| Binary Formats + +|cbor +|application/cbor +|http://cbor.io/[Concise Binary Object Representation] + +|smile +|application/smile +|https://en.wikipedia.org/wiki/Smile_(data_interchange_format)[Smile] binary data format similar to CBOR + +|=== -Alternatively you can set the `Accept` HTTP header to the appropriate media -format. The GET parameter takes precedence over the header. If neither is -specified then the response is returned in the same format as the request. [source,js] -------------------------------------------------- @@ -80,7 +129,11 @@ Which returns: -------------------------------------------------- // TESTRESPONSE[s/sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWWWdrRlVfSS1TbDYtcW9lc1FJNmlYdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl\+v\/\/\/w8=/$body.cursor/] -You can continue to the next page by sending back the `cursor` field. In +[[sql-pagination]] +[float] +=== Paginating through a large response + +Using the example above, onu can continue to the next page by sending back the `cursor` field. In case of text format the cursor is returned as `Cursor` http header. [source,js] @@ -111,7 +164,7 @@ Which looks like: -------------------------------------------------- // TESTRESPONSE[s/sDXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAAEWODRMaXBUaVlRN21iTlRyWHZWYUdrdw==:BAFmBmF1dGhvcgFmBG5hbWUBZgpwYWdlX2NvdW50AWYMcmVsZWFzZV9kYXRl9f\/\/\/w8=/$body.cursor/] -Note that the `column` object is only part of the first page. +Note that the `columns` object is only part of the first page. You've reached the last page when there is no `cursor` returned in the results. Like Elasticsearch's <>, @@ -145,9 +198,11 @@ Which will like return the [[sql-rest-filtering]] +[float] +=== Filtering using {es} query DSL You can filter the results that SQL will run on using a standard -Elasticsearch query DSL by specifying the query in the filter +{es} query DSL by specifying the query in the filter parameter. [source,js] @@ -181,10 +236,48 @@ Douglas Adams |The Hitchhiker's Guide to the Galaxy|180 |1979-10-12T // TESTRESPONSE[_cat] [[sql-rest-fields]] -In addition to the `query` and `cursor` fields, the request can -contain `fetch_size` and `time_zone`. `fetch_size` is a hint for how -many results to return in each page. SQL might chose to return more -or fewer results though. `time_zone` is the time zone to use for datetime -functions and datetime parsing. `time_zone` defaults to `utc` and can take -any values documented -http://www.joda.org/joda-time/apidocs/org/joda/time/DateTimeZone.html[here]. +[float] +=== Supported REST parameters + +In addition to the `query` and `fetch_size`, a request a number of user-defined fields for specifying +the request time-outs or localization information (such as timezone). + +The table below lists the supported parameters: + +[cols="^m,^m,^5"] + +|=== + +s|name +s|Default value +s|Description + +|query +|Mandatory +|SQL query to execute + +|fetch_size +|1000 +|The maximum number of rows (or entries) to return in one response + +|filter +|none +|Optional {es} query DSL for additional <>. + +|request_timeout +|90s +|The timeout before the request fails. + +|page_timeout +|45s +|The timeout before a pagination request fails. + +|time_zone +|`Z` (or `UTC`) +|Time-zone in ISO 8601 used for executing the query on the server. +More information available https://docs.oracle.com/javase/8/docs/api/java/time/ZoneId.html[here]. + +|=== + +Do note that most parameters (outside the timeout ones) make sense only during the initial query - any follow-up pagination request only requires the `cursor` parameter as explained in the <> chapter. +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. \ No newline at end of file diff --git a/docs/reference/sql/endpoints/translate.asciidoc b/docs/reference/sql/endpoints/translate.asciidoc index cd7f1cc846e..6a347ff614a 100644 --- a/docs/reference/sql/endpoints/translate.asciidoc +++ b/docs/reference/sql/endpoints/translate.asciidoc @@ -4,7 +4,7 @@ == SQL Translate API The SQL Translate API accepts SQL in a JSON document and translates it -into native Elasticsearch queries. For example: +into native {es} queries. For example: [source,js] --------------------------------------------------