我试图在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?