Hi.
We used to order a terms aggregation by a "max_score" sub-aggregation in Elasticsearch 6.5:
{
"size": 0,
"query": { ... },
"aggregations": {
"assets": {
"terms": {
"field": "type_of",
"size": 10,
"order": [
{
"max_score": "desc"
},
{
"_key": "asc"
}
]
},
"aggregations": {
"max_score": {
"max": {
"script": {
"source": "_score",
"lang": "expression"
}
}
}
}
}
}
}
We're in the process of upgrading to 7.x and trying to use _score
causes an error now:
Caused by: org.elasticsearch.script.ScriptException: link error
...
Caused by: java.text.ParseException: Unknown variable [_score]
What's the matter here? Is that a bug?
/edit: BTW, using painless
instead works. But is it as fast as the expression script?
Thanks!