All Products
Search
Document Center

Tablestore:GroupByDateHistogram

Last Updated:May 13, 2024

GroupByDateHistogram groups query results based on specific data intervals. Field values that are within the same range are grouped together. The value range of each group and the number of values in each group are returned.

Request parameters

message GroupByDateHistogram {
    optional string field_name = 1;
    optional DateTimeValue interval = 2;
    optional FieldRange field_range = 3;
    optional bytes missing = 4;
    optional int64  min_doc_count = 5;
    optional string time_zone = 6;
    optional GroupBySort sort = 7;
    optional Aggregations sub_aggs = 8;
    optional GroupBys sub_group_bys = 9;
}

Parameter

Type

Required

Description

field_name

string

Yes

The field that is used for aggregation.

interval

DateTimeValue

Yes

The interval configuration.

field_range

FieldRange

Yes

The range that is used together with the interval parameter to limit the number of groups. The value that is calculated by using the (field_range.max-field_range.min)/interval formula cannot exceed 2,000.

missing

bytes

No

The default value of a field if the value of the field is empty in the row. The value of the parameter is encoded in PlainBuffer. For more information, see PlainBuffer.

  • If you do not specify a value for the missing parameter, the row is ignored.

  • If you specify a value for the missing parameter, the value of this parameter is used as the field value of the row.

min_doc_count

int64

No

The minimum number of rows. If the number of rows in a group is less than the minimum number of rows, the aggregation results for the group are not returned.

time_zone

string

No

The time zone in the +hh:mm or -hh:mm format, such as +08:00 or -09:00.

sort

GroupBySort

No

The sorting rules for items in a group. By default, items are sorted in descending order. If you configure multiple sorting rules, data is sorted based on the order in which the rules are configured.

sub_aggs

Aggregations

No

The sub-aggregation operation that is performed based on the grouping results.

sub_group_bys

GroupBys

No

The sub-GroupBy operation that is performed based on the grouping results.

Response parameters

message GroupByDateHistogramResult {
    repeated GroupByDateHistogramItem group_by_date_histogram_items = 1;
}

Parameter

Type

Required

Description

group_by_date_histogram_items

repeated GroupByDateHistogramItem

Yes

The returned groups.