# Merge two buckets muli\_level inside buckets

**URL:** <https://discuss.elastic.co/t/merge-two-buckets-muli-level-inside-buckets/349547>\
**Category:** Elasticsearch\
**Created:** [December 18, 2023, 10:14am UTC](https://discuss.elastic.co/t/merge-two-buckets-muli-level-inside-buckets/349547 "2023-12-18T10:14:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Azizi\_BESSEM](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azizi_bessem/32/127904_2.png) [@Azizi\_BESSEM](https://discuss.elastic.co/u/Azizi_BESSEM)\
**Post date:** [December 18, 2023, 10:14am UTC](https://discuss.elastic.co/t/merge-two-buckets-muli-level-inside-buckets/349547/1 "2023-12-18T10:14:55Z")

</div>

```auto
{
  "aggregations" : {
    "alert_types" : {
      "doc_count_error_upper_bound" : 0,
      "sum_other_doc_count" : 0,
      "buckets" : [
        {
          "key" : "1",
          "doc_count" : 3,
          "device_refs" : {
            "doc_count_error_upper_bound" : 0,
            "sum_other_doc_count" : 0,
            "buckets" : [
              {
                "key" : "over_voltage",
                "doc_count" : 2
              },
              {
                "key" : "under_voltage",
                "doc_count" : 1
              }
            ]
          }
        },
        {
          "key" : "2",
          "doc_count" : 3,
          "device_refs" : {
            "doc_count_error_upper_bound" : 0,
            "sum_other_doc_count" : 0,
            "buckets" : [
              {
                "key" : "over_voltage",
                "doc_count" : 2
              },
              {
                "key" : "off_ligne",
                "doc_count" : 1
              }
            ]
          }
        }
      ]
    }
  }
}

```

i want to merge the two bucket in one bucket because i need to paginate the result , please your support team

---

<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:** [January 15, 2024, 10:15am UTC](https://discuss.elastic.co/t/merge-two-buckets-muli-level-inside-buckets/349547/2 "2024-01-15T10:15:12Z")

</div>

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