Commit graph

112 commits

Author SHA1 Message Date
Marios Trivyzas
9cd89c3453 SQL: Increase hard limit for sorting on aggregates (#43220)
To be consistent with the `search.max_buckets` default setting,
set the hard limit of the PriorityQueue used for in memory sorting,
when sorting on an aggregate function, to 10000.

Fixes: #43168

(cherry picked from commit 079e012fde)
2019-06-14 13:51:38 +02:00
Andrei Stefan
8de65daa45 Rename TESTRESPONSE[_cat] to TESTRESPONSE[non_json] (#43087)
(cherry picked from commit 897b24e056)
2019-06-11 12:40:00 +03:00
Andrei Stefan
5b35ec1d9b Restructure the SQL Language section to have proper sub-sections (#43007)
Rest docs page update
- have the section be on separate pages
- add an Overview page
- add other formats examples

(cherry picked from commit 309bd691ff)
2019-06-11 12:39:59 +03:00
Andrei Stefan
4a3287836d SQL: Clarify that the connections the jdbc driver creates are not pooled (#42992)
(cherry picked from commit 406d5281bd)
2019-06-11 12:39:58 +03:00
James Rodewig
5913723788 [DOCS] Change // TESTRESPONSE[_cat] to // TESTRESPONSE[non_json] (#43006) 2019-06-10 09:53:05 -04:00
Marios Trivyzas
6c50246a58
SQL: [Docs] Fix links syntax (#42806)
Fix a couple of wrong links because of the order of the anchor
and the usage of backquotes.

(cherry picked from commit 4e0c652515)
2019-06-03 17:51:19 +02:00
James Rodewig
f51f8ed04c [DOCS] Remove unneeded options from [source,sql] code blocks (#42759)
In AsciiDoc, `subs="attributes,callouts,macros"` options were required
to render `include-tagged::` in a code block.

With elastic/docs#827, Elasticsearch Reference documentation migrated
from AsciiDoc to Asciidoctor.

In Asciidoctor, the `subs="attributes,callouts,macros"` options are no
longer needed to render `include-tagged::` in a code block. This commit
removes those unneeded options.

Resolves #41589
2019-05-31 13:05:13 -04:00
James Rodewig
d521a88e19 [DOCS] Move callouts to end of line for Asciidoctor migration (#42356) 2019-05-24 15:03:46 -04:00
Costin Leau
9fdf4215dd Docs: Documentation for the upcoming SQL support of frozen indices (#41863)
(cherry picked from commit a3cc03eb15)
(cherry picked from commit f42dcf2ffd)
2019-05-23 21:16:16 +03:00
Igor Motov
2f8c5ac6f8 Docs: Mark SQL Geo functionality as beta (#42138)
Adds beta marker to geosql documentation
2019-05-15 10:51:33 -04:00
Igor Motov
70ea3cf847
SQL: Add initial geo support (#42031) (#42135)
Adds an initial limited implementations of geo features to SQL. This implementation is based on the [OpenGIS® Implementation Standard for Geographic information - Simple feature access](http://www.opengeospatial.org/standards/sfs), which is the current standard for GIS system implementation. This effort is concentrate on SQL option AKA ISO 19125-2. 

Queries that are supported as a result of this initial implementation

Metadata commands

- `DESCRIBE table`  - returns the correct column types `GEOMETRY` for geo shapes and geo points.
- `SHOW FUNCTIONS` - returns a list that includes supported `ST_` functions
- `SYS TYPES` and `SYS COLUMNS` display correct types `GEO_SHAPE` and `GEO_POINT` for geo shapes and geo points accordingly. 

Returning geoshapes and geopoints from elasticsearch

- `SELECT geom FROM table` - returns the geoshapes and geo_points as libs/geo objects in JDBC or as WKT strings in console.
- `SELECT ST_AsWKT(geom) FROM table;` and `SELECT ST_AsText(geom) FROM table;`- returns the geoshapes ang geopoints in their WKT representation;

Using geopoints to elasticsearch

- The following functions will be supported for geopoints in queries, sorting and aggregations: `ST_GeomFromText`, `ST_X`, `ST_Y`, `ST_Z`, `ST_GeometryType`, and `ST_Distance`. In most cases when used in queries, sorting and aggregations, these function are translated into script. These functions can be used in the SELECT clause for both geopoints and geoshapes. 
- `SELECT * FROM table WHERE ST_Distance(ST_GeomFromText(POINT(1 2), point) < 10;` - returns all records for which `point` is located within 10m from the `POINT(1 2)`. In this case the WHERE clause is translated into a range query.

Limitations:

Geoshapes cannot be used in queries, sorting and aggregations as part of this initial effort. In order to fully take advantage of geoshapes we would need to have access to geoshape doc values, which is coming in #37206. `ST_Z` cannot be used on geopoints in queries, sorting and aggregations since we don't store altitude in geo_point doc values.

Relates to #29872
Backport of #42031
2019-05-14 18:57:12 -05:00
Marios Trivyzas
d5b0badeb7
SQL: Remove CircuitBreaker from parser (#41835)
The CircuitBreaker was introduced as means of preventing a
`StackOverflowException` during the build of the AST by the parser.

The ANTLR4 grammar causes a weird behaviour for a Parser Listener.
The `enterEveryRule()` method is often called with a different parsing
context than the respective `exitEveryRule()`. This makes it difficult
to keep track of the tree's depth, and a custom Map was used as an
attempt of matching the contextes as they are encounter during `enter`
and during `exit` of the rules.

This approach had 2 important drawbacks:
1. It's hard to maintain this custom Map as the grammar changes.
2. The CircuitBreaker could often lead to false positives which caused
valid queries to return an Exception and prevent them from executing.

So, this removes completely the CircuitBreaker which is replaced be
a simple handling of the `StackOverflowException`

Fixes: #41471
(cherry picked from commit 1559a8e2db)
2019-05-07 23:25:37 +03:00
Marios Trivyzas
228d23de6d
SQL: [Docs] Add example for custom bucketing with CASE (#41787)
Add a TIP on how to use CASE to achieve custom bucketing
with GROUP BY.

Follows: #41349

(cherry picked from commit eb5f5d4553)
2019-05-06 18:05:03 +03:00
James Rodewig
53702efddd [DOCS] Add anchors for Asciidoctor migration (#41648) 2019-04-30 10:20:17 -04:00
Nik Everett
d1a3ae2268 Docs: Drop last inline callouts
Drops some inline callouts that snuck into 7.x. We're doings this in
preparation for switching the elasticsearch reference to asciidoctor
which doesn't support them.
2019-04-23 14:20:22 -04:00
Marios Trivyzas
e991175776
SQL: Implement IIF(<cond>, <result1>, <result2>) (#41420)
Implement a more trivial case of the CASE expression which is
expressed as a traditional function with 2 or 3 arguments. e.g.:

IIF(a = 1, 'one', 'many')
IIF(a > 0, 'positive')
Closes: #40917

(cherry picked from commit add02f4f55)
2019-04-23 16:31:25 +03:00
Marios Trivyzas
67d4e399c2
SQL: Implement CASE... WHEN... THEN... ELSE... END (#41349)
Implement the ANSI SQL CASE expression which provides the if/else
functionality common to most programming languages.

The CASE expression can have multiple WHEN branches and becomes a
powerful tool for SQL queries as it can be used in SELECT, WHERE,
GROUP BY, HAVING and ORDER BY clauses.

Closes: #36200
(cherry picked from commit 8b2577406f)
2019-04-22 19:26:56 +03:00
James Rodewig
d2a418152d [DOCS] Remove inline callouts for Asciidoctor migration (#41309) 2019-04-22 09:35:22 -04:00
James Rodewig
3c60f967af [DOCS] Remove inline callouts in SQL Command docs for Asciidoctor migration (#41276) 2019-04-22 09:23:13 -04:00
James Rodewig
490ad2af46 [DOCS] Remove inline callouts for Asciidoctor migration (#41266) 2019-04-22 09:09:21 -04:00
Nik Everett
7d5ff5a1fa Docs: Drop inline callouts from two SQL pages (#41270)
Drops inline callouts from the docs for SQL's string and type-conversion
functions because they are not compatible with Asciidoctor.
2019-04-16 15:28:30 -04:00
Nik Everett
a01dd96afe Drop inline callouts from SQL conditional docs (#41205)
Drops "inline callouts" from the docs for SQL conditionals because they
aren't supported by Asciidoctor.

Relates to #41128
2019-04-16 13:52:36 -04:00
Marios Trivyzas
c8047c0644 SQL: [Docs] Small fixes for CURRENT_TIMESTAMP docs (#40792)
- Added square brackets for the optional argument of precision
- Fixed character to lower case after comma

(cherry picked from commit d2f6f3b9ce)
2019-04-04 11:45:20 +02:00
Marios Trivyzas
f3c207d27b SQL: Implement CURRENT_TIME/CURTIME functions (#40662)
After `TIME` SQL data type is introduced, implement
`CURRENT_TIME/CURTIME` functions similarly to CURRENT_TIMESTAMP
that return the system's current time (only, without the date part).

Closes: #40468
(cherry picked from commit 9feede7814)
2019-04-04 11:45:20 +02:00
Marios Trivyzas
952c4d9653
SQL: Fix display size for DATE/DATETIME (#40669)
A full format for a DATETIME would be:
`2019-03-30T10:20:30.123+10:00` which is 29 chars long.

For DATE a full format would be: `2019-03-30T00:00:00.000+10:00`
which is also 29 chars long.


(cherry picked from commit 6be83964ed)
2019-04-03 13:29:04 +02:00
Marios Trivyzas
899ed2bf81 SQL: Introduce SQL TIME data type (#39802)
Support ANSI SQL's TIME type by introductin a runtime-only
ES SQL time type.

Closes: #38174
(cherry picked from commit 046ccd4cf0)
2019-04-01 23:57:27 +02:00
Andrei Stefan
f8d3d685e5 SQL: Documentation for LIKE and RLIKE operators (#40623)
(cherry picked from commit 9536c5f7b7)
2019-04-01 18:15:47 +03:00
Andrei Stefan
8cd96ee160 Add JDBC trustore type to the docs (#40592)
(cherry picked from commit cafde31129)
2019-04-01 18:15:46 +03:00
Marios Trivyzas
6edb802716
SQL: [Docs] Fix doc errors regarding CURRENT_DATE. (#40649)
Some parts wrongly refered to CURRENT_TIMESTAMP.

(cherry picked from commit 3dd0384d68)
2019-03-30 12:08:38 +01:00
Andrei Stefan
fe32ce6009 Include functions' aliases in the list of functions (#40584)
(cherry picked from commit 4034f8f316)
2019-03-28 14:39:19 +02:00
Andrei Stefan
89d97905e5 SQL: add "fuzziness" option to QUERY and MATCH function predicates (#40529)
* Remove unused "locale" and "lowercase_expanded_terms" options from QUERY.

(cherry picked from commit c122fc6edd)
2019-03-28 10:37:09 +02:00
Costin Leau
de5f924daa SQL: Adjust the precision and scale for drivers (#40467)
Fix #40357

(cherry picked from commit 1557d77b07)
2019-03-28 10:08:09 +02:00
Andrei Stefan
99dca30197 SQL: MATCH and QUERY documentation; one list of functions (#40494)
* Document MATCH and QUERY function predicates.
* Polish the functions pages and add a list of functions to the main Functions & Operators page.

(cherry picked from commit 4cec0ae1b9)
2019-03-27 17:37:10 +02:00
Bogdan Pintea
6182b464a3 SQL: ODBC: document extra connection string parameters (#40476)
* document ODBC's extra connection string parameters

Document the connection string parameters that are currently not
configurable from the GUI.

Add a note about SmartScreen possible warning on driver MSI
installation.

Add a note about the TLS certificate file not being supported as bundled
or password-protected.

* rephrasing and restructuring the list of params

- addressing PR review notes

* rephrasings and reference linking

- addressing PR review notes

(cherry picked from commit ca90190226)
2019-03-27 14:20:23 +01:00
Costin Leau
38dc005b8d SQL: Update JDBC class name in client screenshots
(cherry picked from commit 79a3b93deb)
2019-03-27 12:21:53 +02:00
Costin Leau
61f49af497 SQL: Spec tests now use classpath discovery (#40388)
To avoid having to specify each spec by hand (which can miss specs to be
added), the test infrastructure now performs classpath discovery so that
each spec added, is automatically considered.

Relates #40358

(cherry picked from commit d0f60b4425)
2019-03-25 15:22:52 +02:00
Costin Leau
496070fda6 SQL: CAST supports both SQL and ES types (#40365)
Extend CAST to support all data types notations (whether SQL or ES
specific)

Fix #40282

(cherry picked from commit eb2ee8a344)
2019-03-22 23:55:51 +02:00
Costin Leau
970cd57368 DOC: polish client docs
(cherry picked from commit 72e413df26)
2019-03-22 19:43:56 +02:00
Costin Leau
980ee14f57 DOC: Expand section on ORDER BY aggs (#40332)
(cherry picked from commit 99d2f6fc98)
2019-03-22 10:04:52 +02:00
Costin Leau
076a68007c SQL: Add multi_value_field_leniency inside FieldHitExtractor (#40113)
For cases where fields can have multi values, allow the behavior to be
customized through a dedicated configuration field.
By default this will be enabled on the drivers so that existing datasets
work instead of throwing an exception.
For regular SQL usage, the behavior is false so that the user is aware
of the underlying data.

Fix #39700

(cherry picked from commit 2b35157196)
2019-03-18 14:56:03 +02:00
Lisa Cawley
c92476f591 [DOCS] Replaces CCS terms with attributes (#40076) 2019-03-15 07:57:51 -07:00
Costin Leau
3960374a6f SQL: Introduce MAD (MedianAbsoluteDeviation) aggregation (#40048)
Add Median Absolute Deviation aggregation

Fix #39597

(cherry picked from commit 4f09613942)
2019-03-15 11:45:15 +02:00
Andrei Stefan
ba44f28340 SQL: ignore UNSUPPORTED fields for JDBC and ODBC modes in 'SYS COLUMNS' (#39518)
* SYS COLUMNS will skip UNSUPPORTED field types in ODBC and JDBC, as well.
NESTED and OBJECT types were already skipped in ODBC mode, now they are
skipped in JDBC mode, as well.

(cherry picked from commit 9e0df64b2d)
2019-03-01 15:26:31 +02:00
Andrei Stefan
542e2c55f6 SQL: change the default precision for CURRENT_TIMESTAMP function (#39391)
(cherry picked from commit dbb93310b0)
2019-02-27 09:49:42 +02:00
Andrei Stefan
4deb69e9e4 SQL: introduce the columnar option for REST requests (#39287)
* Add "columnar" option for REST requests (but be lenient for non-"plain"
modes) for json, yaml, smile and cbor formats.
* Updated documentation

(cherry picked from commit 5b7e0de237)
2019-02-27 09:37:28 +02:00
Andrei Stefan
92206c8567 Added "validate.properties" property to JDBC's list of allowed properties. (#39050)
This defaults to "true" (current behavior) and will throw an exception
if there is a property that cannot be recognized. If "false", it will
ignore anything unrecognizable.

(cherry picked from commit 38fbf9792b)
2019-02-20 11:29:01 +02:00
Costin Leau
c5dce42667 SQL: doc polishing 2019-02-15 22:14:36 +02:00
Costin Leau
79bc6aba79 SQL: Polish the rest chapter (#38971)
Organize the text a bit and add tip on triple quotes in Kibana Console
2019-02-15 22:14:36 +02:00
Costin Leau
9357c17288 SQL: Doc on syntax (identifiers in particular) (#38662)
Add section on syntax, identifiers and literals and on single vs double quotes.

(cherry picked from commit aafdb59808)
2019-02-15 15:24:33 +02:00
taku333
8bb2a2a405 SQL: change JDBC setup URL in the documentation (#38564)
(cherry picked from commit 103786ea27)
2019-02-14 17:12:08 +02:00