Only fetch ES aggregations on the first request (#357)

This commit is contained in:
simon987 2023-05-18 19:56:40 -04:00
parent 7920318406
commit 3ffa30cc6f

View File

@ -170,14 +170,16 @@ class Sist2ElasticsearchQuery {
}
},
sort: SORT_MODES[getters.sortMode].mode,
aggs:
{
total_size: {"sum": {"field": "size"}},
total_count: {"value_count": {"field": "size"}}
},
size: size,
} as any;
if (!after) {
q.aggs = {
total_size: {"sum": {"field": "size"}},
total_count: {"value_count": {"field": "size"}}
};
}
if (!empty && !blankSearch) {
q.query.bool.must = query;
}