Elastic Search matrix_stats on both nested and non nested value

we have a doc structure

[{
  score: 10,
  list: [  // nested type
    {
      id : 3,
      value: 10
    },
    {
      id: 4
      value: 20
    },
    {
      id: 5,
      value: 15
    }
  ]
},
{
  score: 1,
  list: [
    {
      id : 3,
      value: 4
    },
    {
      id: 4
      value: 3
    },
    {
      id: 5,
      value: 2
    }
  ]
}...

we're trying to do matrix_stats aggregation on field “score” and nested field “value” and considering only specific ids like 4,

we couldn't find a way to do matrix_stats aggregation on both nested(list.value) and non nested(score) field

example, in 1st doc score is 10 and value of nested list matching id = 4 is 20 … likewise any possible ways to get the value by scripts or runtimeMapping etc….

or is there any way we can access parent field inside nested aggregation for matrix_stats aggregation

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