Aggregate document and "cumulate" fields

Hi,
i would like to know if it's possible to aggregate documents and cumulate other fields in an array like this :

Documents :

{
  "type": "fruit",
  "article": "apple",
  "price": 5
}
{
  "type": "fruit",
  "article": "orange",
  "price": 7
}
{
  "type": "clothing",
  "article": "t-shirt",
  "price": 13
}
{
  "type": "clothing",
  "article": "shoes",
  "price": 51
}

The expected results :

{
  "buckets": [
    {
      "type": "fruit",
      "price": [5, 7]
    },
    {
      "type": "clothing",
      "price": [13, 51]
    }
  ]
}

Thanks

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