You are looking at documentation for an older release.
Not what you want? See the
current release documentation.
Max Aggregation Usageedit
Fluent DSL Exampleedit
s => s
.Aggregations(a => a
.Max("max_commits", m => m
.Field(p => p.NumberOfCommits)
)
)Object Initializer Syntax Exampleedit
new SearchRequest<Project>
{
Aggregations = new MaxAggregation("max_commits", Field<Project>(p => p.NumberOfCommits))
}Example json output.
{
"aggs": {
"max_commits": {
"max": {
"field": "numberOfCommits"
}
}
}
}
Handling Responsesedit
response.ShouldBeValid();
var max = response.Aggs.Max("max_commits");
max.Should().NotBeNull();
max.Value.Should().BeGreaterThan(0);