在聚合查询数据时使用profile API发现,其聚合查询花费的时间主要集中在terms聚合的build Aggregation上,具体如下:
"aggregations": [
{
"type": "GlobalOrdinalsStringTermsAggregator",
"description": "mac",
"time_in_nanos": 6406614745,
"breakdown": {
"reduce": 0,
"build_aggregation": 6338523283,
"build_aggregation_count": 1,
"initialize": 242277,
"initialize_count": 1,
"reduce_count": 0,
"collect": 67599166,
"collect_count": 250017
},
"children": [
{
"type": "CardinalityAggregator",
"description": "reqType_num",
"time_in_nanos": 310045957,
"breakdown": {
"reduce": 0,
"build_aggregation": 214412854,
"build_aggregation_count": 135010,
"initialize": 3970,
"initialize_count": 1,
"reduce_count": 0,
"collect": 95248387,
"collect_count": 245735
}
},
{
"type": "FilterAggregator",
"description": "filter_reqType_1",
"time_in_nanos": 108192242,
"breakdown": {
"reduce": 0,
"build_aggregation": 43866710,
"build_aggregation_count": 135010,
"initialize": 160531,
"initialize_count": 1,
"reduce_count": 0,
"collect": 63784255,
"collect_count": 245735
},
"children": [
{
"type": "FilterAggregator",
"description": "filter_errCode",
"time_in_nanos": 53118070,
"breakdown": {
"reduce": 0,
"build_aggregation": 15039014,
"build_aggregation_count": 135010,
"initialize": 3020,
"initialize_count": 1,
"reduce_count": 0,
"collect": 37824240,
"collect_count": 116785
}
}
]
},
{
"type": "FilterAggregator",
"description": "filter_reqType_7",
"time_in_nanos": 43802491,
"breakdown": {
"reduce": 0,
"build_aggregation": 16563229,
"build_aggregation_count": 135010,
"initialize": 1406,
"initialize_count": 1,
"reduce_count": 0,
"collect": 26857110,
"collect_count": 245735
}
}
]
}
]
},
数据大概100多万条,该如何优化?
"aggregations": [
{
"type": "GlobalOrdinalsStringTermsAggregator",
"description": "mac",
"time_in_nanos": 6406614745,
"breakdown": {
"reduce": 0,
"build_aggregation": 6338523283,
"build_aggregation_count": 1,
"initialize": 242277,
"initialize_count": 1,
"reduce_count": 0,
"collect": 67599166,
"collect_count": 250017
},
"children": [
{
"type": "CardinalityAggregator",
"description": "reqType_num",
"time_in_nanos": 310045957,
"breakdown": {
"reduce": 0,
"build_aggregation": 214412854,
"build_aggregation_count": 135010,
"initialize": 3970,
"initialize_count": 1,
"reduce_count": 0,
"collect": 95248387,
"collect_count": 245735
}
},
{
"type": "FilterAggregator",
"description": "filter_reqType_1",
"time_in_nanos": 108192242,
"breakdown": {
"reduce": 0,
"build_aggregation": 43866710,
"build_aggregation_count": 135010,
"initialize": 160531,
"initialize_count": 1,
"reduce_count": 0,
"collect": 63784255,
"collect_count": 245735
},
"children": [
{
"type": "FilterAggregator",
"description": "filter_errCode",
"time_in_nanos": 53118070,
"breakdown": {
"reduce": 0,
"build_aggregation": 15039014,
"build_aggregation_count": 135010,
"initialize": 3020,
"initialize_count": 1,
"reduce_count": 0,
"collect": 37824240,
"collect_count": 116785
}
}
]
},
{
"type": "FilterAggregator",
"description": "filter_reqType_7",
"time_in_nanos": 43802491,
"breakdown": {
"reduce": 0,
"build_aggregation": 16563229,
"build_aggregation_count": 135010,
"initialize": 1406,
"initialize_count": 1,
"reduce_count": 0,
"collect": 26857110,
"collect_count": 245735
}
}
]
}
]
},
数据大概100多万条,该如何优化?
1 个回复
rochy - rochy_he
赞同来自: