Has_child script_field查询显示没有这样的属性:_score

时间:2018-06-07 07:29:29

标签: elasticsearch groovy

我试图在has_child查询中运行script_field,如下所示。

{
  "query": {
    "has_child": {
      "type": "applications",
      "inner_hits": {
        "script_fields": {
          "parent": {
            "script": {
              "lang": "groovy",
              "file": "application_sort"
            }
          },
          "child": {
            "script": {
              "lang": "groovy",
              "file": "application_sort"
            }
          }
        }
      },
      "query": {
        "match_all": {}
      }
    }
  }
}

application_sort是脚本文件名,包含以下行:

return _score + doc['applied_date'].value

此查询提供如下错误...

"type": "missing_property_exception",
"reason": "No such property: `_score` for class: 18642b..

如何在脚本中访问_score?

0 个答案:

没有答案