比如我们有很多的4s店,然后呢给了用户一个app,在某个地方的时候,可以根据当前的地理位置搜索一下,自己附近的4s店
pom 文件引入
org.locationtech.spatial4j
spatial4j
0.6
com.vividsolutions
jts
1.13
xerces
xercesImpl
mapping
POST /car_shop/_mapping/shops
{
"properties": {
"pin": {
"properties": {
"location": {
"type": "geo_point"
}
}
}
}
}初始化数据
PUT /car_shop/shops/1
{
"name": "上海至全宝马4S店",
"pin" : {
"location" : {
"lat" : 40.12,
"lon" : -71.34
}
}
}
PUT /car_shop/shops/2
{
"name": "上海顺风宝马4S店",