I was trying to run a script_field in the has_child query as follows.
{
"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 is the script file name, which contains the following line,
return _score + doc['applied_date'].value
This query gives error as follows...
"type": "missing_property_exception",
"reason": "No such property: _score for class: 18642b..
How can I access the _score in script?