我创建了一个索引,如下所示:
POST /cabtrails
{
"settings" :
{
"number_of_shards" : 3,
"number_of_replicas" : 1
},
"mappings" : {
"cabtrail" :{
"properties" : {
"location": {
"type": "geo_point",
"geohash_prefix": true,
"geohash_precision": "5m"
},
"capture_time": {
"type" : "long"
},
"client_id": {
"type" : "long"
}
}
}
}
}
它工作正常并创建了一个索引。
我输入了一份样本文件:
POST cabtrails/cabtrail
{
"capture_time": 1431849367077,
"client_id": 865527029812357,
"location": "13.0009316,77.5947316"
}
这也很好。在这里,我期望 ElasticSearch 会生成一个我可以使用的 geohash 字段/条目。
但是,当我查询时,我得到了这个:
GET cabtrails/_search
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "cabtrails",
"_type": "cabtrail",
"_id": "AU2LrEaze2aqxPjHm-UI",
"_score": 1,
"_source": {
"capture_time": 1431849367077,
"client_id": 865527029812357,
"location": "13.0009316,77.5947316"
}
}
]
}
}
我期待u10hbp
查询结果中某处的地理哈希字符串,我可以用它来查询未来的位置点。还是我对 geohash+ES 的概念搞砸了??帮助!!