【发布时间】:2021-02-15 19:29:34
【问题描述】:
我有一个索引field,使用它,给定一组多边形坐标,我想获得与这些坐标相交的任何字段。考虑到使用elasticsearch 地理位置功能的field 索引的结构,这是否可能?我正在使用弹性搜索 7.9 版
{
"geo_json": {
"geometry": {
"coordinates": [
[
[
2.1228971832029644,
41.3011586218355
],
[
2.122596585111679,
41.3012384865674
],
[
2.1221786804481835,
41.30191870980272
],
[
2.1223509744761158,
41.302042636348716
],
[
2.1226735685285507,
41.30192972550523
],
[
2.1232820963718857,
41.30165984025794
],
[
2.1232820963718857,
41.30131559725024
],
[
2.1228971832029644,
41.3011586218355
]
]
],
"type": "Polygon"
},
"properties": null,
"type": "Feature"
},
"name": "Barcelona"
}
我尝试了以下查询,返回错误"Field [geo_json.geometry.coordinates] is of unsupported type [float]. [geo_shape] query supports the following types [geo_shape,geo_point]"
GET field/_search
{
"query": {
"bool": {
"filter": {
"geo_shape": {
"geo_json.geometry.coordinates": {
"shape": {
"type": "polygon",
"coordinates": [
[
[
2.1228971832029644,
41.3011586218355
],
[
2.122596585111679,
41.3012384865674
],
[
2.1221786804481835,
41.30191870980272
],
[
2.1223509744761158,
41.302042636348716
],
[
2.1226735685285507,
41.30192972550523
],
[
2.1232820963718857,
41.30165984025794
],
[
2.1232820963718857,
41.30131559725024
],
[
2.1228971832029644,
41.3011586218355
]
]
]
},
"relation": "intersects"
}
}
}
}
}
}
【问题讨论】:
标签: elasticsearch intersection