GroupByRange groups search results into buckets based on numeric ranges. Each bucket covers a left-closed, right-open interval and returns the number of matched rows within that range.
Request parameters
message GroupByRange {
optional string field_name = 1;
repeated Range ranges = 2;
optional Aggregations sub_aggs = 3;
optional GroupBys sub_group_bys = 4;
}
|
Parameter |
Type |
Required |
Description |
|
field_name |
string |
Yes |
The numeric field to group by. |
|
ranges |
repeated Range |
Yes |
The range intervals to create buckets for. Each interval is left-closed and right-open: |
|
sub_aggs |
No |
A sub-aggregation to run on each bucket. |
|
|
sub_group_bys |
No |
A sub-GroupBy to run on each bucket. |
Response parameters
message GroupByRangeResult {
repeated GroupByRangeResultItem group_by_range_result_items = 1;
}
|
Parameter |
Type |
Required |
Description |
|
group_by_range_result_items |
repeated GroupByRangeResultItem |
Yes |
The list of buckets returned, one per range interval. |