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.
Histogram aggregation
editHistogram aggregation
editA multi-bucket values source based aggregation that can be applied on numeric values extracted from the documents.
Fluent DSL
editvar result = client.Search<ElasticsearchProject>(s => s .Aggregations(a => a .Histogram("my_histogram_agg", h => h .Field(p => p.LOC) .Interval(100) ) ) ); var agg = result.Aggs.Histogram("my_histogram_agg");
Object Initializer Syntax
editvar request = new SearchRequest { Aggregations = new Dictionary<string, IAggregationContainer> { { "my_histogram_agg", new AggregationContainer { Histogram = new HistogramAggregator { Field = "loc", Interval = 100 } } } } }; var result = client.Search<ElasticsearchProject>(request); var agg = result.Aggs.Histogram("my_histogram_agg");
Refer to the {ref_current}/search-aggregations-bucket-histogram-aggregation.html[original docs] for more information.