无论如何,为Spatial Search ElasticSearch映射类型此结构:
"coordinates" : {
"type" : "Point",
"coordinates" : [
100.41404641,
5.37384675
]
},
我想知道使用它来自我的MongoDB地理点类型,而不将它们分成像现有教程和示例那样的纬度和长字段 .
这个结构是Twitter API默认流的结构,因此我可以将它作为“location”:{“lat”:100.41,“long”:5.34}保存到MongoDB中 . 但是在将额外的字段添加到我的数据库或更改内容之前,我想确保在ElasticSearch中无法使用此结构进行空间搜索 .
谢谢
1 Answer
根据ElasticSearch documents,可以在映射中将lat和long数组作为Geo点类型 .
制图:
格式在[lon,lat],注意,lon / lat的顺序在这里,以符合GeoJSON .
Geo-point数据类型的其他示例:
地理点表示为字符串,格式为:"lat,lon"
Geo-point表示为geohash
地理点表示为数组,格式为:[lon,lat]