es geo point 距离搜索最近的距离

{
    "from":0,
    "size":1,
    "query":{
        "bool":{
            "must":[
                {"term":{"sfsc":0}}
            ]
        }
    },
    "sort":[{
        "_geo_distance":{
            "jwd":{
                "lat":36.9,
                "lon":120.6
            },
            "unit":"m",
            "order":"asc"
        }
    }]
}

jwd是索引的字段field,unit是距离单位,m,km order.asc就是取最近的,返回结果的sort就是距离,单位是上面的unit

"sort":[
     10.0333
]

猜你喜欢

转载自blog.csdn.net/c5113620/article/details/80235492
GEO