fluentnest icon indicating copy to clipboard operation
fluentnest copied to clipboard

Get more than one group (not nested)

Open existeundelta opened this issue 9 years ago • 2 comments

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!

existeundelta avatar Jun 09 '16 15:06 existeundelta

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 avatar Jun 10 '16 07:06 filpen

@filpen do you think that with something like this https://github.com/elastic/elasticsearch-net/issues/1740 can't be acomplished?

existeundelta avatar Jun 10 '16 09:06 existeundelta