# Range inside aggregations

**URL:** <https://discuss.elastic.co/t/range-inside-aggregations/72843>\
**Category:** Elasticsearch\
**Created:** [January 26, 2017, 1:12am UTC](https://discuss.elastic.co/t/range-inside-aggregations/72843 "2017-01-26T01:12:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumo7](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@sumo7](https://discuss.elastic.co/u/sumo7)\
**Post date:** [January 26, 2017, 1:12am UTC](https://discuss.elastic.co/t/range-inside-aggregations/72843/1 "2017-01-26T01:12:38Z")

</div>

I'm new to Elasticsearch.  
I have been reading docs offered on Elasticsearch website.  
My question is from [Elasticsearch Reference [5.1] » Getting Started » Exploring Your Data » Executing Aggregations](https://www.elastic.co/guide/en/elasticsearch/reference/current/_executing_aggregations.html)  
The description of the last example says "ages 20-29, 30-39, and 40-49", but the values of "to" in the example are 30, 40, 50 respectively.  
Shouldn't the values of "to" be 29, 39, and 49 as described?  
I can't tell if this is an error or correct.

---

<div class="post-metadata">

**Author:** ![varundbest](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varundbest/32/48066_2.png) [@varundbest](https://discuss.elastic.co/u/varundbest)\
**Post date:** [January 26, 2017, 10:28am UTC](https://discuss.elastic.co/t/range-inside-aggregations/72843/2 "2017-01-26T10:28:55Z")

</div>

No, it actually says :-

> ```
> "from": 20,
> "to": 30
> },
> {
> "from": 30,
> "to": 40
> },
> {
> "from": 40,
> "to": 50
> 
> ```

and in "from" or "to", you don't actually consider the boundary values. So its more like this :- (20, 30) rather than [20,30] in mathematical notation.

So "from" is actually :- "value" \> "20"  
and for \>= we have "gte" and \<= we have "lte" which translate to "Greater than, equal to" and "less than, equal to" respectively.

---

<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:** [February 23, 2017, 10:28am UTC](https://discuss.elastic.co/t/range-inside-aggregations/72843/3 "2017-02-23T10:28:54Z")

</div>

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