# Aggregation of values in a array of nested objects

**URL:** https://discuss.elastic.co/t/aggregation-of-values-in-a-array-of-nested-objects/121560
**Category:** Kibana
**Created:** [February 26, 2018, 8:13pm UTC](https://discuss.elastic.co/t/aggregation-of-values-in-a-array-of-nested-objects/121560 "2018-02-26T20:13:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ivanjunckes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ivanjunckes/32/28192_2.png) [@ivanjunckes](https://discuss.elastic.co/u/ivanjunckes)
#### Post date: [February 26, 2018, 8:13pm UTC](https://discuss.elastic.co/t/aggregation-of-values-in-a-array-of-nested-objects/121560/1 "2018-02-26T20:13:48Z")

</div>

I am trying to solve an issue with nested objects and I would like your help.

An event like this is sent to elasticsearch:

```
{
  "proxy_steps": [
    {
      "category": "build_proxy_request",
      "elapsed_sec": 4
    },
    {
      "category": "process_rewrite",
      "elapsed_sec": 9
    },
    {
      "category": "rewrite_authentication",
      "elapsed_sec": 1
    },
    {
      "category": "rewrite_authorization",
      "elapsed_sec": 9
    },
    {
      "category": "rewrite_check_flags",
      "elapsed_sec": 7
    },
    {
      "category": "rewrite_rule_evaluation",
      "elapsed_sec": 2
    },
    {
      "category": "rewrite_rule_evaluation",
      "elapsed_sec": 8
    },
    {
      "category": "proxy_response",
      "elapsed_sec": 5
    }
  ]
}

```

I would show it in a visualization aggregating the elaspsed\_sec average per category. For example, rewrite\_rule\_evaluation average would be 5.

I know it works in elastic search but I couldn't make it work in Kibana. Kibana doesn't support aggregations of nested objects, as per documentation on [https://www.elastic.co/guide/en/kibana/5.5/nested-objects.html](https://www.elastic.co/guide/en/kibana/5.5/nested-objects.html). But I am wondering if there is a way to do it with scripted aggregations.

Can anyone help?

---

<div class="post-metadata">

### Author: ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)
#### Post date: [February 27, 2018, 6:24pm UTC](https://discuss.elastic.co/t/aggregation-of-values-in-a-array-of-nested-objects/121560/2 "2018-02-27T18:24:30Z")

</div>

Hey @ivanjunckes I'm not aware of a way to use scripted aggregations to get around the nested objects limitations, and we generally recommend denormalizing your data in these situations.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 27, 2018, 6:24pm UTC](https://discuss.elastic.co/t/aggregation-of-values-in-a-array-of-nested-objects/121560/3 "2018-03-27T18:24:30Z")

</div>

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