【发布时间】:2017-02-15 20:31:29
【问题描述】:
是否有一个选项可以像这样在 ElasticSearch 中使用一个查询来执行搜索:
- 获取 ID = 1 的文档
- 此文档有一个带有 geo_shape 映射的字段
- 从该字段中获取值
- 搜索 geo_shape 字段与 doc(id=1) geo_shape 相交的其他文档
- 返回找到的文档
?
【问题讨论】:
标签: elasticsearch geojson elasticsearch-geo-shape
是否有一个选项可以像这样在 ElasticSearch 中使用一个查询来执行搜索:
?
【问题讨论】:
标签: elasticsearch geojson elasticsearch-geo-shape
是的,您可以为此目的使用pre-indexed shapes。
POST /_search
{
"query": {
"bool": {
"must": {
"match_all": {}
},
"filter": {
"geo_shape": {
"your_shape_field": {
"indexed_shape": {
"id": "1",
"type": "your_type",
"index": "your_index",
"path": "shape"
},
"relation": "intersects"
}
}
}
}
}
}
此查询将返回所有具有 your_shape_field 与 ID 为 1 的文档中的 shape 字段相交的文档。
【讨论】: