elasticsearch - [location]的映射定义具有不受支持的参数:[geohash:true]:Elasticsearch 5.X

标签 elasticsearch geopoints elasticsearch-5 geohashing

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

最佳答案

引用documentation

geo_point fields

Like Numeric fields the Geo point field now uses the new BKD tree structure. Since this structure is fundamentally designed for multi-dimension spatial data, the following field parameters are no longer needed or supported: geohash, geohash_prefix, geohash_precision, lat_lon. Geohashes are still supported from an API perspective, and can still be accessed using the .geohash field extension, but they are no longer used to index geo point data.


似乎不再支持/需要它。参见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
  }
}

关于elasticsearch - [location]的映射定义具有不受支持的参数:[geohash:true]:Elasticsearch 5.X,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42385407/

相关文章:

elasticsearch - 将两个单词作为一个单词进行加工

elasticsearch - 如何按特定字段过滤 Elasticsearch 词或短语建议器?

c# - 通过Nest在Elasticsearch中使用同义词

ruby-on-rails - 合并 Elasticsearch 查询和过滤器无法正常工作

elasticsearch - 确定哪些点在Kibana上的Elastic Map Service边界内

elasticsearch - Elasticsearch中的地理位置索引数组

java - 无法使用 Java API 在 ElasticSearch 1.7.3 中索引 GeoPoints

elasticsearch - 什么是最适合用于 ElasticSearch 聚合的数据类型 5 : numeric or keyword?

javascript - 可以用node的Elasticsearch在不重写的情况下仅更新特定字段吗?

java - 当Elasticsearch批量操作发生故障时,如何获取文档字段?