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);