略微加速

Elasticsearch权威指南 - 互联网笔记

地理坐标点 | Elasticsearch: 权威指南 | Elastic

2024-04-20

地理坐标点编辑

地理坐标点 是指地球表面可以用经纬度描述的一个点。 地理坐标点可以用来计算两个坐标间的距离,还可以判断一个坐标是否在一个区域中,或在聚合中。

地理坐标点不能被动态映射 dynamic mapping)自动检测,而是需要显式声明对应字段类型为 geo-point

PUT /attractions
{
  "mappings": {
    "restaurant": {
      "properties": {
        "name": {
          "type": "string"
        },
        "location": {
          "type": "geo_point"
        }
      }
    }
  }
}

官方地址:https://www.elastic.co/guide/cn/elasticsearch/guide/current/geopoints.html

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3