当我运行此脚本以将经度和纬度倍数级联到geo_point中时,出现错误。
ElasticsearchIllegalArgumentException[the character \'.\' is not a valid geohash character]
这是我的脚本供引用:
mappings: {
'index': {
'transform': {
'lang': 'groovy',
'script': "ctx._source['coords'] = [ctx._source['lon'],ctx._source['lat']]"
}
'properties': {
'lon': {
'type': 'double',
},
'lat': {
'type': 'string',
},
'coords': {
'type': 'geo_point',
}
}
}
}
我将不胜感激,谢谢!
最佳答案
由于要从源中提取数据,因此需要在常规脚本中将字符串转换为 double :
new Double(ctx._source['lon']);
关于elasticsearch - Elasticsearch:转换量翻倍至geo_point。无效的geohash字符错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31148329/