I'm trying to mock an Aggregation result for a Unit Test.
var mockedSearchResponse = SearchResponse.of(r -> r
.took(10)
.timedOut(false)
.hits(h -> h
.total(t -> t.value(8).relation(TotalHitsRelation.Eq))
.hits(Collections.emptyList()))
.aggregations(Map.of(
"memUsagePctAvg", new Aggregate("avg", JsonData.of(0.01)),
"cpuTotalAvg", new Aggregate("avg", JsonData.of(0.0)))
)
.shards(s -> s
.total(1)
.failed(0)
.successful(1))
);
However, there is an issue with calling new Aggregate(). It puts my "avg" kind into the _customKind field, and sets the Aggregate _kind to Kind._Custom.
Is there an example somewhere that uses the Aggregate.of() function instead.