Overview
This topic describes the Aggregate class and its methods.
Constructor (1)
This constructor requires you to specify a field to be aggregated.
Aggregate(String groupkey)
Parameter description
Parameter | Type | Description |
---|---|---|
groupkey | String | Required. The field to be aggregated. This field must be an attribute field of the int type or a literal type. |
Constructor (2)
This constructor requires no parameter.
Aggregate()
setGroupKey
Method definition
Specifies a field to be aggregated.
Aggregate setGroupKey(String groupkey)
Parameter description
Parameter | Type | Description |
---|---|---|
groupkey | String | The field to be aggregated. |
getGroupKey
Method definition
Obtains the specified field to be aggregated.
String getGroupKey()
Return value
The specified field to be aggregated.
setAggFun
Method definition
Specifies an aggregation function.
Aggregate setAggFun(String aggfun)
Parameter description
Parameter | Type | Description |
---|---|---|
aggfun | String | The aggregation function. Valid values: count(), sum(), max(), and min(). |
getAggFun
Method definition
Obtains the specified aggregation function.
String getAggFun()
Return value
The specified aggregation function.
setAggFilter
Method definition
Specifies an aggregation filter.
Aggregate setAggFilter(String aggFilter)
Parameter description
Parameter | Type | Description |
---|---|---|
aggFilter | String | The aggregation filter. |
getAggFilter
Method definition
Obtains the specified aggregation filter.
String getAggFilter()
Return value
The specified aggregation filter.
setRange
Method definition
Specifies an aggregation range.
Aggregate setRange(String range)
Parameter description
Parameter | Type | Description |
---|---|---|
range | String | The aggregation range. You can set only one range and the range must be in the form of number1~number2. Only values within the range and values that are greater than number2 will be aggregated. Range-based aggregation is not supported for fields of the STRING type. Example: 0-10. |
getRange
Method definition
Obtains the specified aggregation range.
String getRange()
Return value
The specified aggregation range.
setAggSamplerThresHold
Method definition
Specifies a threshold for sampled aggregation.
Aggregate setAggSamplerThresHold(String aggSamplerThreHold)
Parameter description
Parameter | Type | Description |
---|---|---|
aggSamplerThreHold | String | Optional. The threshold for sampled aggregation. The documents that do not exceed the threshold are all aggregated. The documents that exceed the threshold are sampled for aggregation. |
getAggSamplerThresHold
Method definition
Obtains the specified threshold for sampled aggregation.
String getAggSamplerThresHold()
Return value
The specified threshold for sampled aggregation.
setAggSamplerStep
Method definition
Specifies a step for sampled aggregation.
Aggregate setAggSamplerStep(String aggSamplerStep)
Parameter description
Parameter | Type | Description |
---|---|---|
aggSamplerStep | String | Optional. The step for sampled aggregation, which indicates the number of documents between the two documents that are selected for sampled aggregation. This parameter applies to the documents whose corresponding values exceed the threshold that is specified by the aggSamplerThreHold parameter. If the aggregation function is sum() or count(), the estimated aggregation results of the documents that exceed the threshold are the product of the sampled aggregation results and the specified step. The final aggregation results of all the documents are the sum of the preceding estimated aggregation results and the aggregation results of all the documents that do not exceed the threshold. |
getAggSamplerStep
Method definition
Obtains the specified step for sampled aggregation.
String getAggSamplerStep()
Return value
The specified step for sampled aggregation.
setMaxGroup
Method definition
Specifies the maximum number of groups that can be returned each time.
Aggregate setMaxGroup(String maxGrop)
Parameter description
Parameter | Type | Description |
---|---|---|
maxGrop | String | The maximum number of groups that can be returned each time. Default value: 1000. |
getMaxGroup
Method definition
Obtains the specified maximum number of groups that can be returned each time.
String getMaxGroup()
Return value
The specified maximum number of groups that can be returned each time.