Geo查询 - drjsite/elasticsearch-sql GitHub Wiki

目前支持的Geo查询

geo_bounding_box
geo_distance
geo_polygon
geo_shape
geojson_shape

示例

select * from student where location.coordinate between [30,70] and [20,50]   --geo_bounding_box
select * from student where location.coordinate in [30.132,50],[40,60],[50,212](/drjsite/elasticsearch-sql/wiki/30.132,50],[40,60],[50,212)  --geo_polygon
select * from student where location.coordinate=[40,30] and distance='100km'  --geo_distance

--geo_shape
-- 语法: where [field] [relation] [coordinates] shaped as [shape]
select * from student where location.coordinate within [10,10],[20,20](/drjsite/elasticsearch-sql/wiki/10,10],[20,20) shaped as envelope
select * from student where location.coordinate contains [[10,10],[20,20](/drjsite/elasticsearch-sql/wiki/[10,10],[20,20),[11,11],[21,21](/drjsite/elasticsearch-sql/wiki/11,11],[21,21)] shaped as multilinestring
select * from student where location.coordinate disjoint [[[10,10],[20,20],[11,11],[21,21](/drjsite/elasticsearch-sql/wiki/[[10,10],[20,20],[11,11],[21,21)],[[10,10],[20,20],[11,11],[21,21](/drjsite/elasticsearch-sql/wiki/[10,10],[20,20],[11,11],[21,21)]] shaped as multipolygon

--geo_shape query by geojson
select * from student where location.coordinate disjoint `{"coordinates": [-155.52, 19.61], [-156.22, 20.74], [-157.97, 21.46](/drjsite/elasticsearch-sql/wiki/-155.52,-19.61],-[-156.22,-20.74],-[-157.97,-21.46), "type": "MultiPoint"}`