Skip to content

Commit f9f63ae

Browse files
Mpdreamzawelburn
authored and
awelburn
committed
removed PreOffset and PostOffset and introduced Offset (elastic#2845)
1 parent 31eccdd commit f9f63ae

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

src/Nest/Aggregations/Bucket/Histogram/HistogramAggregation.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,8 @@ public interface IHistogramAggregation : IBucketAggregation
2626
[JsonProperty("extended_bounds")]
2727
ExtendedBounds<double> ExtendedBounds { get; set; }
2828

29-
[JsonProperty("pre_offset")]
30-
long? PreOffset { get; set; }
31-
32-
[JsonProperty("post_offset")]
33-
long? PostOffset { get; set; }
29+
[JsonProperty("offset")]
30+
double? Offset { get; set; }
3431

3532
[JsonProperty("missing")]
3633
double? Missing { get; set; }
@@ -44,8 +41,7 @@ public class HistogramAggregation : BucketAggregationBase, IHistogramAggregation
4441
public int? MinimumDocumentCount { get; set; }
4542
public HistogramOrder Order { get; set; }
4643
public ExtendedBounds<double> ExtendedBounds { get; set; }
47-
public long? PreOffset { get; set; }
48-
public long? PostOffset { get; set; }
44+
public double? Offset { get; set; }
4945
public double? Missing { get; set; }
5046

5147
internal HistogramAggregation() { }
@@ -71,9 +67,7 @@ public class HistogramAggregationDescriptor<T>
7167

7268
ExtendedBounds<double> IHistogramAggregation.ExtendedBounds { get; set; }
7369

74-
long? IHistogramAggregation.PreOffset { get; set; }
75-
76-
long? IHistogramAggregation.PostOffset { get; set; }
70+
double? IHistogramAggregation.Offset { get; set; }
7771

7872
double? IHistogramAggregation.Missing { get; set; }
7973

@@ -102,9 +96,7 @@ public HistogramAggregationDescriptor<T> OrderDescending(string key) =>
10296
public HistogramAggregationDescriptor<T> ExtendedBounds(double min, double max) =>
10397
Assign(a => a.ExtendedBounds = new ExtendedBounds<double> { Minimum = min, Maximum = max });
10498

105-
public HistogramAggregationDescriptor<T> PreOffset(long preOffset) => Assign(a => a.PreOffset = preOffset);
106-
107-
public HistogramAggregationDescriptor<T> PostOffset(long postOffset) => Assign(a => a.PostOffset = postOffset);
99+
public HistogramAggregationDescriptor<T> Offset(double offset) => Assign(a => a.Offset = offset);
108100

109101
public HistogramAggregationDescriptor<T> Missing(double missing) => Assign(a => a.Missing = missing);
110102
}

src/Tests/Aggregations/Bucket/Histogram/HistogramAggregationUsageTests.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public HistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) :
2727
order = new
2828
{
2929
_key = "desc"
30-
}
30+
},
31+
offset = 1.1
3132
}
3233
}
3334
}
@@ -40,6 +41,7 @@ public HistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) :
4041
.Interval(100)
4142
.Missing(0)
4243
.Order(HistogramOrder.KeyDescending)
44+
.Offset(1.1)
4345
)
4446
);
4547

@@ -51,7 +53,8 @@ public HistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) :
5153
Field = Field<Project>(p => p.NumberOfCommits),
5254
Interval = 100,
5355
Missing = 0,
54-
Order = HistogramOrder.KeyDescending
56+
Order = HistogramOrder.KeyDescending,
57+
Offset = 1.1
5558
}
5659
};
5760

0 commit comments

Comments
 (0)