我有一个列表geoshape文件,如下所示:
{
"location" : {
"type" : "circle",
"coordinates" : [-45.0, 45.0],
"radius" : "8000m"
}
}
给定一个lat / lng,我想找到这个lat / lng所在的所有文件。
答案 0 :(得分:2)
您需要使用geo_shape
这样的查询:
{
"query": {
"bool": {
"filter": {
"geo_shape": {
"location": {
"shape": {
"type": "point",
"coordinates": [ -77.03653, 38.897676 ] <-- lon/lat to search
},
"relation": "contains" <-- use the contains relationship
}
}
}
}
}
}
在coordinates
参数中,确保在纬度之前设置经度,而不是相反(感谢GeoJSON)