WARNING: Version 5.x has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Handling Responsesedit
Using the .Agg
aggregation helper we can fetch our aggregation results easily
in the correct type. Be sure to read more about .Aggs vs .Aggregations
Handling Responsesedit
response.ShouldBeValid(); var dateHistogram = response.Aggs.DateRange("projects_date_ranges"); dateHistogram.Should().NotBeNull(); dateHistogram.Buckets.Should().NotBeNull();
We specified three ranges so we expect to have three of them in the response
dateHistogram.Buckets.Count.Should().Be(3); foreach (var item in dateHistogram.Buckets) { item.DocCount.Should().BeGreaterThan(0); }