# Kibana Query How to Drop Partial Buckets?

**URL:** <https://discuss.elastic.co/t/kibana-query-how-to-drop-partial-buckets/235602>\
**Category:** Kibana\
**Created:** [June 3, 2020, 4:24pm UTC](https://discuss.elastic.co/t/kibana-query-how-to-drop-partial-buckets/235602 "2020-06-03T16:24:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vdalvi](https://avatars.discourse-cdn.com/v4/letter/v/54ee81/32.png) [@vdalvi](https://discuss.elastic.co/u/vdalvi)\
**Post date:** [June 3, 2020, 4:24pm UTC](https://discuss.elastic.co/t/kibana-query-how-to-drop-partial-buckets/235602/1 "2020-06-03T16:24:05Z")

</div>

Hi,

I get the below three buckets typically in my query result when I run my query. Is it possible to drop the partial buckets? Lets assume I get 3 buckets (B1, B2, B3). I just want to view results of B2 (please see required result below)in my query result and drop B1 and B3 for example.

Actual Result

```auto
      "buckets" : [
        {
          "key_as_string" : "2020-06-03T14:15:00.000Z",
          "key" : 1591193700000,
          "doc_count" : 78139554,
          "cmtsId_list" : {
            "doc_count_error_upper_bound" : 126180,
            "sum_other_doc_count" : 78097327,
            "buckets" : [
              {
                "key" : "b5cb9b4fe8be1663eb3bc593b2ad21e6afe29448",
                "doc_count" : 42227
              }
            ]
          },
          "numberof_cmtsId" : {
            "value" : 4022
          }
        },
        {
          "key_as_string" : "2020-06-03T15:00:00.000Z",
          "key" : 1591196400000,
          "doc_count" : 447759475,
          "cmtsId_list" : {
            "doc_count_error_upper_bound" : 530945,
            "sum_other_doc_count" : 447259815,
            "buckets" : [
              {
                "key" : "eaca9ef3c7ed39402a7101b1ab1443338d0607de",
                "doc_count" : 499660
              }
            ]
          },
          "numberof_cmtsId" : {
            "value" : 4133
          }
        },
        {
          "key_as_string" : "2020-06-03T15:45:00.000Z",
          "key" : 1591199100000,
          "doc_count" : 82735016,
          "cmtsId_list" : {
            "doc_count_error_upper_bound" : 115872,
            "sum_other_doc_count" : 82664949,
            "buckets" : [
              {
                "key" : "91259535611a418126767957fa70c13339ca7b91",
                "doc_count" : 70067
              }
            ]
          },
          "numberof_cmtsId" : {
            "value" : 4054
          }
      }
]

```

Required Result

```auto
{
          "key_as_string" : "2020-06-03T15:00:00.000Z",
          "key" : 1591196400000,
          "doc_count" : 447759475,
          "cmtsId_list" : {
            "doc_count_error_upper_bound" : 530945,
            "sum_other_doc_count" : 447259815,
            "buckets" : [
              {
                "key" : "eaca9ef3c7ed39402a7101b1ab1443338d0607de",
                "doc_count" : 499660
              }
            ]
          },
          "numberof_cmtsId" : {
            "value" : 4133
          }
        },

```

Can someone let me know if thats possible ? Please and thank you 🙂

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [June 3, 2020, 5:28pm UTC](https://discuss.elastic.co/t/kibana-query-how-to-drop-partial-buckets/235602/2 "2020-06-03T17:28:26Z")

</div>

What aggregation are you using for x-axis? The `date histogram` aggregation has a check box to drop partial buckets

 ![Screen Shot 2020-06-03 at 11.26.55 AM](https://us1.discourse-cdn.com/elastic/original/3X/b/6/b67c793b0006c9d1a667bc14a941271f64022265.png)

---

<div class="post-metadata">

**Author:** ![vdalvi](https://avatars.discourse-cdn.com/v4/letter/v/54ee81/32.png) [@vdalvi](https://discuss.elastic.co/u/vdalvi)\
**Post date:** [June 3, 2020, 5:49pm UTC](https://discuss.elastic.co/t/kibana-query-how-to-drop-partial-buckets/235602/3 "2020-06-03T17:49:56Z")

</div>

Hi Nathan,

I am using the date histogram aggregation. Below is my query. However I am not sure how to implement drop partial bucket in kibana query? Sorry I am new to this. Can you please help?

```auto
{
  "query": {
    "range": {
      "timestamp": {
        "gte": "now-90m/m",
        "lte": "now-30m/m"
      }
    }
  },
  "size": 0,
  "aggs": {
    "every45min_list": {
      "date_histogram": {
        "field": "timestamp",
        "fixed_interval": "45m"
      },
      "aggs": {
        "Id_list": {
          "terms": {
            "field": "cmtsId",
            "size": 1
          }
        },
        "numberof_Id": {
          "cardinality": {
            "field": "cmtsId"
          }
        }
      }
    }
  }
}

```

---

<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:** [July 1, 2020, 5:49pm UTC](https://discuss.elastic.co/t/kibana-query-how-to-drop-partial-buckets/235602/4 "2020-07-01T17:49:57Z")

</div>

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