December 2017
Intermediate to advanced
434 pages
10h 29m
English
What if we do not want all buckets to have the same interval? It is possible to create unequal sized buckets by using range aggregation.
The following range aggregation slices the data into three buckets: up to 1 KB, 1 KB to 100 KB, and 100 KB or more. Notice that we can specify from and to in the ranges. Both from and to are optional in the range. If only to is specified, that bucket includes all documents up to the specified value in that bucket. The to value is exclusive and is not included in the current bucket's range:
POST /bigginsight/_search?size=0{ "aggs": { "by_usage": { "range": { "field": "usage", "ranges": [ { "to": 1024 }, { "from": 1024, "to": 102400 }, { "from": 102400 } ] } } }}
The response of this request ...
Read now
Unlock full access