I have the following object model:
{
...
"classification": [
{ "label": "aaa", "probability": 0.9923 },
{ "label": "bbb", "probability": 0.3452 },
{ "label": "ccc", "probability": 0.0012 },
]
}
I want to sort documents based on the label that has the highest probability value.
ie: Identify the label value of the nested object with the highest probability and sort on that.
I've tried this:
"sort": {
"classification.probability": {
"mode": "max",
"order": "desc",
"missing": "_last",
"nested": {
"path": "classification"
}
}
}
But it doesn't seem to be working - it seems to be sorting on the max probability value instead of the label of the object with the max probability value.
Is what I want even possible?