我的文档映射的一部分与下面的映射相同
"locations": {
"type": "nested",
"properties": {
"point": {
"type": "geo_shape",
"tree": "quadtree",
"precision": "100m"
}
}
}
当我尝试在查询中发布
script_field
时,Elasticsearch返回错误failed to run inline script [doc['locations.point'].distanceInMiles(53.4791,-2.2441)] using lang [groovy]
出于以下原因:
failed to find field data builder for field locations.point, and type geo_shape
我假设这是因为该字段是嵌套字段(该字段内部有几个(geo)
points
,并且其中任何一个都与搜索匹配,但是由于嵌套了该字段,因此locations.point
的上下文显然是错误的,因此需要类似于locations.point[10]
(可能是第11个-取决于查询中匹配项的上下文)。那么,有人知道正确执行此操作的方法吗?我是否可以告诉脚本一个特殊的运算符,使其知道需要从字段中查看匹配的
point
?提前致谢。
最佳答案
事实证明,实际上不可能使用geo_shape
的
关于elasticsearch - 嵌套对象中的脚本字段,特别是地理形状,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58408880/