我正在使用 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,
似乎不再支持/需要它。参见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/