NOTE: You are looking at documentation for an older release. For the latest information, see the current release documentation.
Global Aggregation Usage
editGlobal Aggregation Usage
editFluent DSL example
edita => a .Global("all_projects", g => g .Aggregations(aa => aa .Terms("names", t => t .Field(p => p.Name) ) ) )
Object Initializer syntax example
editnew GlobalAggregation("all_projects") { Aggregations = new TermsAggregation("names") { Field = Field<Project>(p => p.Name) } }
Example json output.
{ "all_projects": { "global": {}, "aggs": { "names": { "terms": { "field": "name" } } } } }
Handling Responses
editresponse.ShouldBeValid(); var allProjects = response.Aggregations.Global("all_projects"); allProjects.Should().NotBeNull(); var names = allProjects.Terms("names"); names.Should().NotBeNull();