ES中geo_point类型字段,地球表面可以用经纬度描述的一个点。
1,within a bounding box (Geo Bounding Box Query)
"filter": {
"geo_bounding_box": {//在特定方框内查询
"pin.location": {
"top_left": {"lat": 40.73,"lon": -74.1},//左上
"bottom_right": {"lat": 40.01,"lon": -71.12}//右下
}
}
}
2,certain distance of a central point(Geo Distance Query)
"filter" : {
"geo_distance" : {//...
"distance" : "200km",//距离
"pin.location" : {"lat" : 40, "lon" : -70 } }//距离特定点的周边200km
}
3,within a polygon(多边)(Geo Polygon Query)
"filter" : {
"geo_polygon" : {//在多边形内的求点
"person.location" : {
"points" : [
{"lat" : 40, "lon" : -70},
{"lat" : 30, "lon" : -80},
{"lat" : 20, "lon" : -90}
]
}
}
}
参考文章:
https://blog.youkuaiyun.com/feifantiyan/article/details/54092843