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.
Stats aggregationedit
A multi-value metrics aggregation that computes stats over numeric values extracted from the aggregated documents.
Fluent DSLedit
var result = client.Search<ElasticsearchProject>(s => s .Aggregations(a => a .Stats("my_stats_agg", sa => sa .Field(p => p.Followers.First().Age) ) ) ); var agg = result.Aggs.Stats("my_stats_agg");
Object Initializer Syntaxedit
var request = new SearchRequest { Aggregations = new Dictionary<string, IAggregationContainer> { { "my_stats_agg", new AggregationContainer { Stats = new StatsAggregator { Field = "followers.age" } } } } }; var result = client.Search<ElasticsearchProject>(request); var agg = result.Aggs.Stats("my_stats_agg");
Refer to the original docs for more information.