Bri*_*ger 4 elasticsearch elastica
我在ES中有一些文档,它们有一个"边界"字段.这是该字段内容的一个示例:https://gist.github.com/litzinger/a95342dedc0081c8db8d
给定lon/lat点,我需要能够查询此索引以查找该点所属的文档.我在构建这个查询时遇到了麻烦,似乎无法找到一个如何在任何地方执行此操作的明确示例.
这是我的一个查询的示例,其中坐标数组是lon/lat点.我已经有一个工作查询,它将使用多边形来查找具有lon/lat点的所有文档,但我似乎无法让它以相反的方式工作.
{
"query": {
"filtered": {
"filter": {
"geo_shape": {
"boundaries": {
"relation": "intersects",
"shape": {
"coordinates": [
[
[-96.960876,32.795025]
]
],
"type": "point"
}
}
}
},
"query": {
"match_all": {}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
弄清楚了.首先,我的映射是错误的.该领域被称为"边界"而不是"边界".哎呀.其次,坐标值是错误的.搜索查询应该是:
{
"query": {
"filtered": {
"filter": {
"geo_shape": {
"boundaries": {
"relation": "intersects",
"shape": {
"coordinates": [
-96.960876,
32.795025
],
"type": "point"
}
}
}
},
"query": {
"match_all": {}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1772 次 |
| 最近记录: |