修改es字段为地理位置
2018-09-04 本文已影响0人
H_Man
项目中使用了es,用到了地理位置的特性,如果需要查找附近的人,或者按照距离查找,需要将经纬度坐标设置为geo_point字段.
在es没有数据的情况下,使用es的客户端发送put请求.
- url后面拼对应的索引名就行
- gis为使用保存经纬度的字段
{
"mappings": {
"doc": {
"properties": {
"userId": {
"type": "integer"
},
"gis": {
"type": "geo_point"
},
"lastUpdateTime": {
"type": "date"
}
}
}
}
}