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.
Terms aggregation
editTerms aggregation
editA multi-bucket value source based aggregation where buckets are dynamically built - one per unique value.
Fluent DSL
editvar 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 Syntax
editvar 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.