Skip to content

Commit

Permalink
Add support for date histogram format. (#3594)
Browse files Browse the repository at this point in the history
(cherry picked from commit 0b8fb97)
  • Loading branch information
Stuart Cam authored and russcam committed Apr 2, 2019
1 parent 7117d9a commit 928b681
Showing 1 changed file with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,37 @@ namespace Nest
public interface IDateHistogramRollupGrouping
{
/// <summary>
/// How long to wait before rolling up new documents. By default, the indexer attempts to roll up all data that is available.
/// How long to wait before rolling up new documents. By default, the indexer attempts to roll up all data that is
/// available.
/// </summary>
[DataMember(Name ="delay")]
[DataMember(Name = "delay")]
Time Delay { get; set; }

/// <summary>
/// The date field that is to be rolled up
/// </summary>
[DataMember(Name ="field")]
[DataMember(Name = "field")]
Field Field { get; set; }

/// <summary>
/// Date format. Supports expressive date format pattern.
/// </summary>
[DataMember(Name = "format")]
string Format { get; set; }

/// <summary>
/// The interval of time buckets to be generated when rolling up. E.g. "60m" will produce 60 minute (hourly) rollups.
/// The interval defines the minimum interval that can be aggregated only.
/// </summary>
[DataMember(Name ="interval")]
[DataMember(Name = "interval")]
Time Interval { get; set; }

/// <summary>
/// Defines what time_zone the rollup documents are stored as. Unlike raw data, which can shift timezones on the fly, rolled
/// Defines what time_zone the rollup documents are stored as. Unlike raw data, which can shift timezones on the fly,
/// rolled
/// documents have to be stored with a specific timezone. By default, rollup documents are stored in UT
/// </summary>
[DataMember(Name ="time_zone")]
[DataMember(Name = "time_zone")]
string TimeZone { get; set; }
}

Expand All @@ -47,6 +55,9 @@ public class DateHistogramRollupGrouping : IDateHistogramRollupGrouping
/// <inheritdoc />
public Field Field { get; set; }

/// <inheritdoc />
public string Format { get; set; }

/// <inheritdoc />
public Time Interval { get; set; }

Expand All @@ -61,6 +72,8 @@ public class DateHistogramRollupGroupingDescriptor<T>
{
Time IDateHistogramRollupGrouping.Delay { get; set; }
Field IDateHistogramRollupGrouping.Field { get; set; }

string IDateHistogramRollupGrouping.Format { get; set; }
Time IDateHistogramRollupGrouping.Interval { get; set; }
string IDateHistogramRollupGrouping.TimeZone { get; set; }

Expand All @@ -78,5 +91,8 @@ public class DateHistogramRollupGroupingDescriptor<T>

/// <inheritdoc cref="IDateHistogramRollupGrouping.TimeZone" />
public DateHistogramRollupGroupingDescriptor<T> TimeZone(string timeZone) => Assign(a => a.TimeZone = timeZone);

/// <inheritdoc cref="IDateHistogramRollupGrouping.Format" />
public DateHistogramRollupGroupingDescriptor<T> Format(string format) => Assign(a => a.Format = format);
}
}

0 comments on commit 928b681

Please sign in to comment.