Aggregating relevance _score with nested text fields

I am having difficulties finding documentation or discussions about how to aggregate the _score field for nested text fields. The structure of my index includes one nested field. The structure of a single document is a long text with meta parameters in the "parent" level, and the text's individual sentences (tuple [text, label]) in a nested "text" field. The structure of my _search is as follows:

  1. SEARCH: Nested query that matches a search term with the nested text fields. (ie. does the sentence include this search term?) Note, that using inner_hits, I can see that each nested text sentence in a single parent document is scored individually (they have different scores).
  2. AGGREGATE: bucket the documents on one of the parent variables, and then within those buckets, bucket the nested fields based on the label of the sentence, and average the _score of the sentences inside.

However, what I'm finding is that at the end of the search query and before aggregation, the parent document gets assigned a _score that is the average (score_mode: average) of the matching sentence _scores. Then, in aggregation, all of the nested sentences of a single parent document have the same average _score, and the individual score is lost.

Is there any way to use the individual non-averaged _score on the nested text fields in aggregation, or will it always use the averaged parent _score for each nested sentence? Would it change anything to use parent-child instead of a nested structure?

Thank you.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.