gpt4 book ai didi

elasticsearch - 如何在Elasticsearch结果中返回geo_point的geohash?

转载 作者:行者123 更新时间:2023-12-03 01:54:35 26 4
gpt4 key购买 nike

如何在Elasticsearch结果中返回geo_point的geohash?

例如,位置字段是纬度/经度值。如何将这个字段的geohash添加到结果中?

最佳答案

您需要在查询中添加fielddata_fields,如下所示:

POST /index/_search
{
"query": {
"match_all": {}
},
"fielddata_fields": [
"location.geohash"
]
}

然后,您会得到类似的内容, _sourcefielddata_fields中的geohash
{
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "test",
"_type": "test",
"_id": "1",
"_score": 1,
"_source": {
"location": "13.0009316,77.5947316"
},
"fields": {
"location.geohash": [
"t",
"td",
"tdr",
"tdr1",
"tdr1v",
"tdr1vw",
"tdr1vww",
"tdr1vwwz",
"tdr1vwwzb",
"tdr1vwwzbm"
]
}
}
]
}
}

关于elasticsearch - 如何在Elasticsearch结果中返回geo_point的geohash?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37599267/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com