Is there a way in Elasticsearch to check in which field the results are sorted? I want something like inner-hits for a sort expression.
Imagine that your documents have the following form:
{"numerals" : [ // nested {"key": "point", "value": 30}, {"key": "points", "value": 200}, {"key": "score", "value": 20}, {"key": "scores", "value": 40} ] }
and you sort the results by:
{"numerals.value": { "nested_path": "numerals", "nested_filter": { "match": { "numerals.key": "score"}}}}
Now I have no idea how to find out the field by which the results are actually sorted: maybe scores in this document, but maybe score for the rest? There are 2 problems - 1. You cannot use internal hits or highlight for nested fields. and - 2. Even if possible, this does not solve the problem if there are several suitable candidates.
source share