【问题标题】:Mapping definition for [location] has unsupported parameters: [geohash : true] : Elasticsearch 5.X[location] 的映射定义具有不受支持的参数:[geohash : true]:Elasticsearch 5.X
【发布时间】:2017-02-22 07:40:45
【问题描述】:

我正在使用 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?

【问题讨论】:

    标签: elasticsearch geopoints elasticsearch-5 geohashing


    【解决方案1】:

    引用documentation,

    geo_point 字段

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

    看起来不再支持/不需要它。见here。根据示例,他们使用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
      }
    }
    

    【讨论】:

    • 这就像使用另一个源生成 geohash 并将其显式存储为 elasticsearch。但我需要从存储的 lat lon 格式的 geo_points 自动生成 geohash。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-06
    • 1970-01-01
    相关资源
    最近更新 更多