You are looking at documentation for an older release.
Not what you want? See the
current release documentation.
Date Histogram aggregationedit
A multi-bucket aggregation similar to the histogram except it can only be applied on date values.
Fluent DSLedit
var result = _client.Search<ElasticsearchProject>(s => s .Aggregations(a => a .DateHistogram("my_date_histogram", h => h .Field(p => p.StartedOn) .Interval("month") ) ) ); var agg = result.Aggs.DateHistogram("my_date_histogram");
Object Initializer Syntaxedit
var request = new SearchRequest { Aggregations = new Dictionary<string, IAggregationContainer> { { "my_date_histogram", new AggregationContainer { DateHistogram = new DateHistogramAggregator { Field = "startedOn", Interval = "month" } } } } }; var result = client.Search<ElasticsearchProject>(request); var agg = result.Aggs.DateHistogram("my_date_histogram");
Refer to the original docs for more information.