# Bounds on Ranged Aggs don't seem to be working

**URL:** <https://discuss.elastic.co/t/bounds-on-ranged-aggs-dont-seem-to-be-working/46184>\
**Category:** Elasticsearch\
**Created:** [April 3, 2016, 10:01pm UTC](https://discuss.elastic.co/t/bounds-on-ranged-aggs-dont-seem-to-be-working/46184 "2016-04-03T22:01:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hifitodd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hifitodd/32/8015_2.png) [@hifitodd](https://discuss.elastic.co/u/hifitodd)\
**Post date:** [April 3, 2016, 10:01pm UTC](https://discuss.elastic.co/t/bounds-on-ranged-aggs-dont-seem-to-be-working/46184/1 "2016-04-03T22:01:46Z")

</div>

Hi there,

I'm running into something a bit funny with ranged aggs. I am getting records that are double bucketed when they are at the range endpoint. I am doing it like this:

"range": {  
"field": def.key,  
"keyed": true,  
"ranges" : [  
{ "key" : "Less than 3 Feet", "to" : 3 },  
{ "key" : "3 - 6 Feet", "from" : 3, "to" : 6 },  
{ "key" : "6 - 8 Feet", "from" : 6, "to": 8 }  
]  
}

... so I'm getting records that have a value of '6' and are falling into both the '3 - 6 feet' and the '6 - 8 feet' buckets.

The docs say:  
"Note that this aggregation includes the from value and excludes the to value for each range."

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

Any idea what might be going on?

Thanks so much!

kind regards,

Todd

> **[AudioFlea - The New Hifi Marketplace](https://audioflea.com)**
>
> Find more, easier. List items, faster. Sell more, cheaper.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 4, 2016, 6:32am UTC](https://discuss.elastic.co/t/bounds-on-ranged-aggs-dont-seem-to-be-working/46184/2 "2016-04-04T06:32:47Z")

</div>

Sounds like a bug to me. Could you open an issue with a reproduction script?

---

<div class="post-metadata">

**Author:** ![hifitodd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hifitodd/32/8015_2.png) [@hifitodd](https://discuss.elastic.co/u/hifitodd)\
**Post date:** [April 27, 2016, 5:09pm UTC](https://discuss.elastic.co/t/bounds-on-ranged-aggs-dont-seem-to-be-working/46184/3 "2016-04-27T17:09:38Z")

</div>

Hi dadoonet,

Thanks so much for the reply! I'd be happy to open an issue. Sorry if the answer to this should be obvious, but what do you mean by a "reproduction script" ?

thanks,  
Todd

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 27, 2016, 5:57pm UTC](https://discuss.elastic.co/t/bounds-on-ranged-aggs-dont-seem-to-be-working/46184/4 "2016-04-27T17:57:25Z")

</div>

Something like this:

```auto
DELETE index
PUT index/type/1
{
  "foo": "bar"
}
GET index/type/_search
{
  "query": {
    "match": {
      "foo": "bar"
    }
  }
}

```

---

<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 5, 2017, 10:55pm UTC](https://discuss.elastic.co/t/bounds-on-ranged-aggs-dont-seem-to-be-working/46184/5 "2017-07-05T22:55:49Z")

</div>


