原文地址: https://www.elastic.co/guide/cn/elasticsearch/guide/current/geopoints.html, 版权归 www.elastic.co 所有
英文版地址: https://www.elastic.co/guide/en/elasticsearch/guide/current/geopoints.html
英文版地址: https://www.elastic.co/guide/en/elasticsearch/guide/current/geopoints.html
请注意:
本书基于 Elasticsearch 2.x 版本,有些内容可能已经过时。
本书基于 Elasticsearch 2.x 版本,有些内容可能已经过时。
地理坐标点 (Geo Points)edit
地理坐标点(geo-point) 是指地球表面可以用经纬度描述的一个点。 地理坐标点可以用来计算两个坐标间的距离,还可以判断一个坐标是否在一个区域中,或在聚合中。
地理坐标点不能被动态映射(dynamic mapping)自动检测,必须显式声明字段类型为geo-point:
PUT /attractions
{
"mappings": {
"restaurant": {
"properties": {
"name": {
"type": "string"
},
"location": {
"type": "geo_point"
}
}
}
}
}