我正在尝试有条件地添加聚合
var search = new SearchDescriptor<Foo>();
search.Aggregations(agg =>
agg.Cardinality("dedup", cd => cd.Field(fi => fi.AddressHash).PrecisionThreshold(40000))
.Filter("dontDedup", fl => fl.Filter(ft => ft.Term(te => te.AddressHash, "00000000000000000000000000000000"))));
其次:
if (someCondition) {
search.Aggregations(agg => agg
.Min("min_lat", fl => fl.Field(fi => fi.Latitude))
.Max("max_lat", fl => fl.Field(fi => fi.Latitude))
.Min("min_lon", fl => fl.Field(fi => fi.Longitude))
.Max("max_lon", fl => fl.Field(fi => fi.Longitude))
);
}
第二条.Aggregations语句从第一条语句中清除“ dedup”和“ dontDedup”聚合。而且似乎没有search.Aggregations.Add(... 可以零散添加.aggregations吗?