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.
Max Aggregation Usage
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Max Aggregation Usage
editFluent DSL example
edits => s .Aggregations(a => a .Max("max_commits", m => m .Field(p => p.NumberOfCommits) ) )
Object Initializer syntax example
editnew SearchRequest<Project> { Aggregations = new MaxAggregation("max_commits", Field<Project>(p => p.NumberOfCommits)) }
Example json output.
{ "aggs": { "max_commits": { "max": { "field": "numberOfCommits" } } } }
Handling Responses
editresponse.ShouldBeValid(); var max = response.Aggs.Max("max_commits"); max.Should().NotBeNull(); max.Value.Should().BeGreaterThan(0);