You are looking at documentation for an older release.
Not what you want? See the
current release documentation.
Terms aggregationedit
A multi-bucket value source based aggregation where buckets are dynamically built - one per unique value.
Fluent DSLedit
var result = _client.Search<ElasticsearchProject>(s => s
.Aggregations(a => a
.Terms("my_terms_agg", t => t
.Field(p => p.Country)
)
)
);
var agg = result.Aggs.Terms("my_terms_agg");Object Initializer Syntaxedit
var request = new SearchRequest
{
Aggregations = new Dictionary<string, IAggregationContainer>
{
{ "my_terms_agg", new AggregationContainer
{
Terms = new TermsAggregator
{
Field = "country"
}
}
}
}
};
var result = client.Search<ElasticsearchProject>(request);
var agg = result.Aggs.Terms("my_terms_agg");Refer to the original docs for more information.