OpenSearch/x-pack/plugin
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
..
ccr Refactor TransportSingleShardAction to serialize Writeable responses (#41985) (#42040) 2019-05-09 22:08:31 -07:00
core Remove toStepKeys from LifecycleAction (#41775) 2019-05-10 16:06:42 -06:00
data-frame [ML] adding pivot.max_search_page_size option for setting paging size (#41920) (#42079) 2019-05-10 13:22:31 -05:00
deprecation Switch run task to use real distro (#41590) 2019-05-06 12:34:07 -07:00
graph Switch run task to use real distro (#41590) 2019-05-06 12:34:07 -07:00
ilm Switch run task to use real distro (#41590) 2019-05-06 12:34:07 -07:00
logstash Switch run task to use real distro (#41590) 2019-05-06 12:34:07 -07:00
ml [ML] relax set upgrade mode test to match what is guaranteed (#41958) (#41979) 2019-05-09 14:28:50 -05:00
monitoring Switch run task to use real distro (#41590) 2019-05-06 12:34:07 -07:00
rollup Cleanup RollupSearch exceptions, disallow partial results (#41272) 2019-05-08 12:38:42 -04:00
security Mute ApiKeyIntegTests 2019-05-09 13:24:52 +01:00
sql SQL: Add initial geo support (#42031) (#42135) 2019-05-14 18:57:12 -05:00
src/test [ML] adding pivot.max_search_page_size option for setting paging size (#41920) (#42079) 2019-05-10 13:22:31 -05:00
watcher Switch run task to use real distro (#41590) 2019-05-06 12:34:07 -07:00
build.gradle Add support for API keys to access Elasticsearch (#38291) 2019-02-05 14:21:57 +11:00