我在圆形 geo_shape 处遇到半径问题。
这里是我的映射;
PUT /circle-example
{
"mappings": {
"properties": {
"location": {
"type": "geo_shape",
"strategy": "recursive"
}
}
}
}
这里是索引请求示例
POST /circle-example/_doc
{
"location" : {
"type" : "circle",
"coordinates" : [70.0, 1.0],
"radius" : "25mi"
}
}
当我计算 [70.0, 0.0] 和 [70.0, 1.0] 之间的距离时,我发现 23,63 英里(小于半径 - 25 英里)。 distance between 2 points
因此;当我使用下面给出的查询进行搜索时,我应该找到文档
GET circle-example/_search
{
"query": {
"bool": {
"must": [
{
"geo_shape": {
"location": {
"shape": {
"type": "point",
"coordinates": [
70.0, 0.0
],
"relation": "contains"
}
}
}
}
]
}
}
}
但是我没有收到正确的结果。这里截图属于答案; Query Result
这意味着; Elasticsearch 说 [70.0, 0.0] 不在中心为 [70.0, 1.0] 且半径为 25 英里的圆中。 然而;它们之间的距离是 23.63 英里,[70.0, 0.0] 在圆圈中。
你能说说这里有什么问题吗?