java专题

修改es字段为地理位置

2018-09-04  本文已影响0人  H_Man

项目中使用了es,用到了地理位置的特性,如果需要查找附近的人,或者按照距离查找,需要将经纬度坐标设置为geo_point字段.
在es没有数据的情况下,使用es的客户端发送put请求.

{
    "mappings": {
        "doc": {
            "properties": {
                "userId": {
                    "type": "integer"
                },
                "gis": {
                    "type": "geo_point"
                },
                "lastUpdateTime": {
                    "type": "date"
                }
            }
        }
    }
}
上一篇 下一篇

猜你喜欢

热点阅读