1

我正在使用elasticsearch 5.2,但是在使用 [geohash:true] 为 geo_point 字段设置索引映射时,出现以下错误

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Mapping definition for [location] has unsupported parameters:  [geohash : true]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping [jdloc]: Mapping definition for [location] has unsupported parameters:  [geohash : true]",
    "caused_by": {
      "type": "mapper_parsing_exception",
      "reason": "Mapping definition for [location] has unsupported parameters:  [geohash : true]"
    }
  },
  "status": 400
}

谁能告诉我 [ geoshash ] 是否已贬值,或者在创建文档时是否有另一种方法可以从 geo_point 字段类型生成和存储 geohash?

4

1 回答 1

3

引用文档

地理点字段

与数字字段一样,地理点字段现在使用新的 BKD 树结构。由于该结构从根本上是为多维空间数据设计的,因此不再需要或支持以下字段参数:geohash、geohash_prefix、geohash_precision、lat_lon。从 API 的角度来看,仍然支持 Geohashes,并且仍然可以使用 .geohash 字段扩展名进行访问,但它们不再用于索引地理点数据。

看起来不再支持/不需要它。见这里。根据他们使用geohash以下映射的示例。

{
  "mappings": {
    "my_type": {
      "properties": {
        "location": {
          "type": "geo_point"
        }
      }
    }
  }
}

 PUT my_index/my_type/3
{
  "text": "Geo-point as a geohash",
  "location": "drm3btev3e86" 
}

更新:

我从文档中了解到的geohash是映射不支持,但您仍然可以访问它。所以应该自动计算。

因此,当您按如下方式进行索引时,您也应该能够访问geohash

PUT my_index/my_type/1
{
  "text": "Geo-point as an object",
  "location": { 
    "lat": 41.12,
    "lon": -71.34
  }
}
于 2017-02-22T07:58:22.110 回答