Commit graph

107 commits

Author SHA1 Message Date
James Rodewig
8f03033635
[DOCS] Move callouts to end of line for Asciidoctor migration (#42356) 2019-05-24 15:03:11 -04:00
Igor Motov
3ac6d527a1
Docs: Mark SQL Geo functionality as beta (#42138)
Adds beta marker to geosql documentation
2019-05-15 10:50:54 -04:00
Igor Motov
0b94416cc1
SQL: Add initial geo support (#42031)
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
2019-05-13 22:17:10 -04:00
Costin Leau
f42dcf2ffd Docs: Tweak list formatting 2019-05-10 17:08:00 +03:00
Costin Leau
a3cc03eb15
Docs: Documentation for the upcoming SQL support of frozen indices (#41863)
Add docs for SQL Frozen indices support
2019-05-10 14:19:26 +03:00
Marios Trivyzas
091d43c494
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
2019-05-07 19:06:06 -04:00
Marios Trivyzas
eb5f5d4553
SQL: [Docs] Add example for custom bucketing with CASE (#41787)
* SQL: [Docs] Add example for custom bucketing with CASE

Add a TIP on how to use CASE to achieve custom bucketing
with GROUP BY.

Follows: #41349

* address comments

* address comment
2019-05-06 18:00:50 +03:00
James Rodewig
adf67053f4
[DOCS] Add anchors for Asciidoctor migration (#41648) 2019-04-30 10:19:09 -04:00
James Rodewig
3a1606bc60
[DOCS] Remove inline callouts for Asciidoctor migration (#41460) 2019-04-24 08:44:01 -04:00
Marios Trivyzas
add02f4f55
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
2019-04-23 16:30:37 +03:00
Marios Trivyzas
8b2577406f
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
2019-04-22 19:26:15 +03:00
James Rodewig
9982888f4e
[DOCS] Remove inline callouts for Asciidoctor migration (#41309) 2019-04-22 06:33:55 -07:00
James Rodewig
d042f263ce
[DOCS] Remove inline callouts in SQL Command docs for Asciidoctor migration (#41276) 2019-04-22 06:22:41 -07:00
James Rodewig
25d81c149b
[DOCS] Remove inline callouts for Asciidoctor migration (#41266) 2019-04-22 06:07:53 -07:00
Nik Everett
da504141f5
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:27:51 -04:00
Nik Everett
8cd40ead74
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:47:39 -04:00
Marios Trivyzas
d2f6f3b9ce
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
2019-04-04 11:31:28 +02:00
Marios Trivyzas
9feede7814
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
2019-04-03 19:35:37 +02:00
Marios Trivyzas
6be83964ed
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.
2019-04-03 13:28:30 +02:00
Marios Trivyzas
046ccd4cf0
SQL: Introduce SQL TIME data type (#39802)
Support ANSI SQL's TIME type by introductin a runtime-only
ES SQL time type.

Closes: #38174
2019-04-01 23:30:39 +02:00
Andrei Stefan
9536c5f7b7
SQL: Documentation for LIKE and RLIKE operators (#40623) 2019-04-01 18:01:03 +03:00
Andrei Stefan
cafde31129
Add JDBC trustore type to the docs (#40592) 2019-04-01 17:34:54 +03:00
Marios Trivyzas
3dd0384d68
SQL: [Docs] Fix doc errors regarding CURRENT_DATE. (#40649)
Some parts wrongly refered to CURRENT_TIMESTAMP.
2019-03-30 12:05:15 +01:00
Andrei Stefan
4034f8f316
Include functions' aliases in the list of functions (#40584) 2019-03-28 14:28:07 +02:00
Andrei Stefan
c122fc6edd
SQL: add "fuzziness" option to QUERY and MATCH function predicates (#40529)
* Remove unused "locale" and "lowercase_expanded_terms" options from QUERY.
2019-03-28 10:11:23 +02:00
Andrei Stefan
4cec0ae1b9
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.
2019-03-27 17:18:14 +02:00
Bogdan Pintea
ca90190226
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
2019-03-27 14:11:59 +01:00
Costin Leau
1557d77b07
SQL: Adjust the precision and scale for drivers (#40467)
Fix #40357
2019-03-27 14:14:06 +02:00
Costin Leau
79a3b93deb SQL: Update JDBC class name in client screenshots 2019-03-27 12:20:16 +02:00
Costin Leau
d0f60b4425
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
2019-03-25 15:22:59 +02:00
Costin Leau
d10195594c 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:59:58 +02:00
Costin Leau
72e413df26 DOC: polish client docs 2019-03-22 19:40:32 +02:00
Costin Leau
3f94ca0c75 DOC: Expand section on ORDER BY aggs (#40332)
(cherry picked from commit 99d2f6fc98)
2019-03-22 10:05:33 +02:00
Costin Leau
2b35157196
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
2019-03-18 14:56:00 +02:00
Lisa Cawley
7a6021ca98
[DOCS] Replaces CCS terms with attributes (#40076) 2019-03-15 07:54:45 -07:00
Costin Leau
4f09613942
SQL: Introduce MAD (MedianAbsoluteDeviation) aggregation (#40048)
Add Median Absolute Deviation aggregation

Fix #39597
2019-03-15 11:45:10 +02:00
Costin Leau
8839a72e55 SQL: DOC polishing 2019-03-14 10:36:19 +02:00
Andrei Stefan
9e0df64b2d
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.
2019-03-01 15:23:15 +02:00
Andrei Stefan
dbb93310b0
SQL: change the default precision for CURRENT_TIMESTAMP function (#39391) 2019-02-27 09:48:10 +02:00
Andrei Stefan
5b7e0de237
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
2019-02-27 09:24:52 +02:00
Andrei Stefan
38fbf9792b
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.
2019-02-20 11:23:47 +02:00
Costin Leau
4140bfc5f1 SQL: doc polishing 2019-02-15 22:12:08 +02:00
Costin Leau
49c7b3b239
SQL: Polish the rest chapter (#38971)
Organize the text a bit and add tip on triple quotes in Kibana Console
2019-02-15 21:15:40 +02:00
Costin Leau
aafdb59808
SQL: Doc on syntax (identifiers in particular) (#38662)
Add section on syntax, identifiers and literals and on single vs double quotes.
2019-02-15 15:24:03 +02:00
taku333
e09cc9f872 SQL: change JDBC setup URL in the documentation (#38564)
(cherry picked from commit 103786ea27)
2019-02-14 17:20:49 +02:00
Marios Trivyzas
526bb65195
SQL: Implement :: cast operator (#38774)
`<expression>::<dataType>` is a simplified altenative syntax to
`CAST(<expression> AS <dataType> which exists in PostgreSQL and
provides an improved user experience and possibly more compact
SQL queries.

Fixes: #38717
2019-02-12 16:50:21 +02:00
Costin Leau
fb6e7a30c9
SQL: remove beta marker from documentation (#38661) 2019-02-10 00:09:03 +02:00
Marios Trivyzas
c9701be1e8
SQL: Implement CURRENT_DATE (#38175)
Since DATE data type is now available, this implements the
`CURRENT_DATE/CURRENT_DATE()/TODAY()` similar to `CURRENT_TIMESTAMP`.

Closes: #38160
2019-02-05 18:15:26 +02:00
Costin Leau
783c9ed372
SQL: Allow sorting of groups by aggregates (#38042)
Introduce client-side sorting of groups based on aggregate
functions. To allow this, the Analyzer has been extended to push down
to underlying Aggregate, aggregate function and the Querier has been
extended to identify the case and consume the results in order and sort
them based on the given columns.
The underlying QueryContainer has been slightly modified to allow a view
of the underlying values being extracted as the columns used for sorting
might not be requested by the user.

The PR also adds minor tweaks, mainly related to tree output.

Close #35118
2019-02-02 01:38:25 +02:00
Marios Trivyzas
19dccf8f3e
SQL: [Docs] Add limitation for aggregate functions on scalars (#38186)
Currently aggregate functions can operate only directly on fields.
They cannot be used on top of scalar functions as painless scripting
is currently not supported.
2019-02-01 16:13:51 +02:00