Using Serial Differencing Aggregation in .NET

I'm tring to use Serial Differencing Aggregation in my C# application.

The function was working properly. However, I found there is no instruction to handle the results of Serial Differencing, but only for Sum Aggregation.

Is there anyone who had experience on calling the Serial Differencing results?

Thanks

Sovled by using:
Dictionary.FirstOrDefault()

For example:
var difference = item.Aggregations.FirstOrDefault(x => x.Key == "serial_diff").Value

And get the value by:
((Nest.ValueAggregate)difference).Value

Hey @ximenling20, the AggregationsHelper is missing a method for SerialDifferencing(); I'll add one now.

In the meantime, you can get the value as you have done :+1: You could also get it with

if (item.Aggregations.TryGetValue("serial_diff", out IAggregate aggregate))
{
    var serialDifferencingAggregate = (ValueAggregate) aggregate;
}

Hey @forloop, thanks for your quick response and the nice alternative.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.