# Clarification on buckets for range aggregation

**URL:** <https://discuss.elastic.co/t/clarification-on-buckets-for-range-aggregation/268435>\
**Category:** Elasticsearch\
**Created:** [March 26, 2021, 4:30am UTC](https://discuss.elastic.co/t/clarification-on-buckets-for-range-aggregation/268435 "2021-03-26T04:30:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amphagory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amphagory/32/46127_2.png) [@Amphagory](https://discuss.elastic.co/u/Amphagory)\
**Post date:** [March 26, 2021, 4:30am UTC](https://discuss.elastic.co/t/clarification-on-buckets-for-range-aggregation/268435/1 "2021-03-26T04:30:09Z")

</div>

I just wanted some clarification on what data would be included in my buckets if I did a range aggregation, it was not clear to me in reading the documentation ([Range aggregation | Elasticsearch Reference [7.12] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-range-aggregation.html#search-aggregations-bucket-range-aggregation)).

Say I have the following example:

```auto
GET /_search
{
  "aggs": {
    "price_ranges": {
      "range": {
        "field": "price",
        "ranges": [
          { "from": 0.0, "to": 100.0 },
          { "from": 100.0, "to": 200.0 },
          { "from": 200.0 }
        ]
      }
    }
  }
}

```

I was wondering if I had the prices of 100.00 and 200.00 which bucket would it fall into? I'm just hoping that these prices don't fall into two buckets.

The real reason I ask is that I have a table in Kibana where I am split a field into time ranges as follows:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/0/302252579cc7f568c53295de002f4058075669fe.png)

I just want to make sure I'm not double counting anything if it falls right on the border.

Mike

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 26, 2021, 4:53am UTC](https://discuss.elastic.co/t/clarification-on-buckets-for-range-aggregation/268435/2 "2021-03-26T04:53:02Z")

</div>

See [Range Aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-range-aggregation.html#search-aggregations-bucket-range-aggregation)

_Note that this aggregation includes the `from` value and excludes the `to` value for each range_

So you can think of this are

greater than or equal to 0 to less than 10  
greater than or equal to 10 to less than 20

and so on...

so 9.99 will go in the first bucket.  
so 10.0 will go in the 2nd bucket

---

<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:** [April 23, 2021, 4:53am UTC](https://discuss.elastic.co/t/clarification-on-buckets-for-range-aggregation/268435/3 "2021-04-23T04:53:25Z")

</div>

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