pub struct DateHistogramAggregation { /* private fields */ }
Expand description
This multi-bucket aggregation is similar to the normal histogram, but it can only be used with date or date range values. Because dates are represented internally in Elasticsearch as long values, it is possible, but not as accurate, to use the normal histogram on dates as well. The main difference in the two APIs is that here the interval can be specified using date/time expressions. Time-based data requires special support because time-based intervals are not always a fixed length.
Implementations§
Source§impl DateHistogramAggregation
impl DateHistogramAggregation
Sourcepub fn calendar_interval(self, calendar_interval: CalendarInterval) -> Self
pub fn calendar_interval(self, calendar_interval: CalendarInterval) -> Self
Calendar-aware intervals are configured with the calendar_interval parameter
Sourcepub fn fixed_interval(self, fixed_interval: Time) -> Self
pub fn fixed_interval(self, fixed_interval: Time) -> Self
In contrast to calendar-aware intervals, fixed intervals are a fixed number of SI units and never deviate, regardless of where they fall on the calendar. One second is always composed of 1000ms. This allows fixed intervals to be specified in any multiple of the supported units.
Sourcepub fn min_doc_count(self, min_doc_count: u32) -> Self
pub fn min_doc_count(self, min_doc_count: u32) -> Self
Only returns terms that match more than a configured number of hits using the min_doc_count
Default value is 1
Sourcepub fn missing(self, missing: DateTime<Utc>) -> Self
pub fn missing(self, missing: DateTime<Utc>) -> Self
The missing parameter defines how documents that are missing a value should be treated. By default they will be ignored but it is also possible to treat them as if they had a value.
Sourcepub fn offset<T>(self, offset: T) -> Selfwhere
T: ToString,
pub fn offset<T>(self, offset: T) -> Selfwhere
T: ToString,
Use the offset parameter to change the start value of each bucket by the specified positive (+) or negative offset (-) duration, such as 1h for an hour, or 1d for a day. See Time units for more possible time duration options.
Sourcepub fn time_zone<T>(self, time_zone: T) -> Selfwhere
T: ToString,
pub fn time_zone<T>(self, time_zone: T) -> Selfwhere
T: ToString,
Elasticsearch stores date-times in Coordinated Universal Time (UTC). By default, all bucketing and rounding is also done in UTC. Use the time_zone parameter to indicate that bucketing should use a different time zone.
Sourcepub fn order<T>(self, order: T) -> Selfwhere
T: Into<TermsOrderCollection>,
pub fn order<T>(self, order: T) -> Selfwhere
T: Into<TermsOrderCollection>,
The order of the buckets can be customized by setting the order parameter. By default, the buckets are ordered by their doc_count descending. Order field allows changing this behavior.
Sorting by ascending
_count
or by sub aggregation is discouraged as it increases the error on document counts. It is fine when a single shard is queried, or when the field that is being aggregated was used as a routing key at index time: in these cases results will be accurate since shards have disjoint values. However otherwise, errors are unbounded. One particular case that could still be useful is sorting by min or max aggregation: counts will not be accurate but at least the top buckets will be correctly picked.
Trait Implementations§
Source§impl Clone for DateHistogramAggregation
impl Clone for DateHistogramAggregation
Source§fn clone(&self) -> DateHistogramAggregation
fn clone(&self) -> DateHistogramAggregation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more