Range inside aggregations


#1

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
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.


(Varun Sharma) #2

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.


(system) #3

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