我正在使用 Elasticsearch 来索引地理数据,并且我有两个点被索引;
{
_index: "shops",
_type: "coffee",
_id: "2",
_version: 73,
found: true,
_source: {
location: {
lat: 50,
lon: 50
},
name: "some random cafe"
}
}
然后我还有一点;
{
_index: "shops",
_type: "coffee",
_id: "3",
_version: 73,
found: true,
_source: {
location: {
lat: 50,
lon: 50
},
name: "another random cafe"
}
}
映射是正确的
{
shops: {
mappings: {
coffee: {
dynamic: "true",
numeric_detection: true,
properties: {
location: {
type: "geo_point",
lat_lon: true,
geohash: true
},
name: {
type: "string",
format: "dateOptionalTime"
}
}
}
}
}
}
然后我正在查询(49.9999、49.9999)内500公里内的所有点,我确定这些点在距离之内;
val lat: Double = 50
val lat: Double = 49.9999
val dist: String = "500km"
client execute {
search in “shops" -> “coffee" filter {
and (
geoDistance("location") point(lat, lon) distance dist,
or(modelIdTerms:_*)
)
} sourceInclude(“name")
} await
只给我一击。完全相同的查询 viacurl
给了我两次点击。这可能是 Elastic4s 的错误吗?