fluentnest
fluentnest copied to clipboard
Get more than one group (not nested)
Would be possible to do something like:
IAggregationContainer aggregations = new AggregationContainerDescriptor<Entity>()
.SumBy<Entity>(x => x.metric1)
.GroupBy(x => x.field1)
.SumBy<Entity>(x => x.metric2)
.SumBy<Entity>(x => x.metric1)
.CardinalityBy(x => x.field2)
.Terms("metricbyfield3", t => t.Field(p => p.field3)
.Size(int.MaxValue)
.Aggregations(aa => aa
.Sum("metric1", sm => sm.Field(p => p.metric1))
)
);
I'm referring to the last part, if I put another Sumby, GroupBy I get a group of groups, and not two different groups, not sure if i'm explaining me correctly? @hoonzis @filpen Thanks!
I don't think we support this case right now, we'll need to come up with a nice syntax to cover this scenario. In the meanwhile, you could do two separate queries with two GroupBys - not ideal but will keep you moving forward.
@filpen do you think that with something like this https://github.com/elastic/elasticsearch-net/issues/1740 can't be acomplished?