elasticsearch geo_point 地理位置:添加测试数据

经纬度英文

longitude:经度
latitude:纬度

创建映射

PUT /meituan_v1
{
  "mappings": {
    "properties": {
      "name": {
        "type": "keyword"
      },
      "location": {
        "type": "geo_point"
      }
    }
  }
}

添加记录

post /meituan_v1/_doc
{
    "name": "肯德基重庆路店",
    "location":{
      "lat": 50,
      "lon": 30
    }
}
post /meituan_v1/_doc
{
    "name": "肯德基红旗街店",
    "location":{
      "lat": 78.5533,  
      "lon":36.5533 
    }
}
post /meituan_v1/_doc
{
    "name": "兰州拉面红旗街店",
    "location":{
      "lat": 78,   
      "lon": 36 
    }
}
post /meituan_v1/_doc
{
    "name": "面对面红旗街店",
    "location":{
      "lat": 78.239,    
      "lon": 37.2832    
    }
}
post /meituan_v1/_doc
{
    "name": "欧亚红旗街店",
    "location":{
      "lat": 76.239,    
      "lon": 35.2832   
    }
}
post /meituan_v1/_doc
{
    "name": "长百红旗街店",
    "location":{
      "lat": 76.99,   
      "lon": 35.99  
    }
}
post /meituan_v1/_doc
{
    "name": "麦当劳红旗街店",
    "location":{
      "lat": 75.88,   
      "lon": 35.88   
    }
}

原文出处:/show_1IX1qHAPTj7e.html