我是Elasticsearch的新手(使用版本 6.2.4 ),尝试使用Point in Polygon(geo_shape)查询
这是我的索引映射
{
"check": {
"mappings": {
"doc": {
"properties": {
"location": {
"type": "geo_shape"
}
}
}
}
}
}
索引中只有一个文档。 位置以19个纬度经度对描述等高线
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "check",
"_type": "doc",
"_id": "1",
"_score": 1,
"_source": {
"location": "POLYGON((-121.3606 38.118,-121.2137 38.097,-121.1175 38.007,-121.0795 37.906,-121.171 37.805,-121.171 37.752,-121.1939 37.702,-121.2361 37.661,-121.2975 37.641,-121.3606 37.638,-121.4186 37.652,-121.466 37.679,-121.5154 37.707,-121.5501 37.752,-121.5546 37.805,-121.6475 37.909,-121.605 38.008,-121.5078 38.098,-121.3606 38.118))"
}
}
]
}
}
我正在执行此查询
GET check/doc/_search
{
"query": {
"geo_shape": {
"location": {
"relation": "intersects",
"shape": {
"type": "point",
"coordinates": [
-121.935791, 37.702152
]
}
}
}
}
}
查询返回零个文档。我尝试将关系作为相交和包含,结果仍然为零。
如果我在Google地图上绘制位置轮廓,则可以清楚地看到查询点(long:-121.935791,lat:37.702152)明显位于位置轮廓