Skip to content

Looping Named Buckets #1742

Closed
Closed
@RobinRieger

Description

@RobinRieger

Is there a way in 2.0 to loop over named buckets (aggregations)?

In 1.7 I was able to do the following

foreach (var row in ((FiltersBucket) searchResultForTimePeriod.Aggregations["repeatBuyers"]).Aggregations.Aggregations) {}

The search looked something like this:

Filters
    ("repeatBuyers",
        fil => fil.Filters
            (f => f.Name(((int) RepeatBuyersGrouping.One).ToString())
                .Range
                    (ra => ra.OnField(of => of.TotalOrders)
                        .LowerOrEquals(1)),
            f => f.Name(((int) RepeatBuyersGrouping.TwoFive).ToString())
                .Range
                    (ra => ra.OnField(of => of.TotalOrders)
                        .Greater(1)
                        .LowerOrEquals(5)),
...

This way I could use the bucket name and the value in the output. I.e. The name of each bucket is a integer and it maps to an enum which I can then use to get the proper 'display' text' for the output.

With 2.0, I can't seem to loop the 'NamedBucket'. Do I need to call them separately now or was this accidentally dropped?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions