Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
<img src="//i.stack.imgur.com/RUiNP.png" height="16" width="18" alt="" class="sponsor tag img">elasticsearch 嵌套对象中的脚本字段特定于geo_形状_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch - Fatal编程技术网 elasticsearch 嵌套对象中的脚本字段特定于geo_形状,elasticsearch,elasticsearch" /> elasticsearch 嵌套对象中的脚本字段特定于geo_形状,elasticsearch,elasticsearch" />

elasticsearch 嵌套对象中的脚本字段特定于geo_形状

elasticsearch 嵌套对象中的脚本字段特定于geo_形状,elasticsearch,elasticsearch,我的文档映射的一部分由下面的映射组成 "locations": { "type": "nested", "properties": { "point": { "type": "geo_shape", "tree": "quadtree", "precision": "100m" } }

我的文档映射的一部分由下面的映射组成

       "locations": {
          "type": "nested",
          "properties": {
            "point": {
              "type": "geo_shape",
              "tree": "quadtree",
              "precision": "100m"
            }
          }
        }
当我试图发出一个
script\u字段作为查询的一部分时,Elasticsearch返回一个错误

无法使用lang[groovy]运行内联脚本[doc['locations.point'].distanceInMiles(53.4791,-2.2441)]

原因如下:

未能找到字段位置的字段数据生成器。点,并键入geo_形状

我假设这是因为该字段是嵌套的(它在字段中有几个(geo)
点,搜索匹配其中任何一个点,但是由于它嵌套了路径
位置的上下文。点
显然是错误的,它需要类似于
位置。点[10]
(对于第11个可能-这取决于查询中匹配项的上下文)

那么,是否有人知道正确执行此操作的方法?是否有特殊的操作员可以告诉脚本,以便它知道需要从字段中查看匹配的


提前感谢。

事实证明,使用
geo_shape