NLPchina / elasticsearch-sql

Use SQL to query Elasticsearch
Apache License 2.0
7k stars 1.54k forks source link

如何让结果集按距离排序返回 #437

Open heyibo8888 opened 7 years ago

heyibo8888 commented 7 years ago

使用ES方式查询时可以使用 curl -XGET "http://localhost:9200/logstash-park/jdbc/_search" -H 'Content-Type: application/json' -d' { "query": { "geo_distance": { "distance": "3km", "geo": { "lat": 28.233971, "lon": 112.945333 } } }, "sort": [ { "_geo_distance": { "geo": { "lat": 28.233971, "lon": 112.945333 }, "order": "asc", "unit": "km", "distance_type": "plane" } } ] }' 改成使用elasticsearch-sql 后 SELECT * FROM logstash-park/jdbc where
GEO_DISTANCE(geo, '3km', 112.945333, 28.233971) 可以正常返回 但无法按照距离进行排序

heyibo8888 commented 7 years ago

image