Skip to content

Commit a74dcda

Browse files
authored
removed PreOffset and PostOffset and introduced Offset (#2845)
Reintroduced removed members for backwards compatibility
1 parent 6a5c5b9 commit a74dcda

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

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

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

29-
[JsonProperty("pre_offset")]
29+
[Obsolete("Removed in Elasticsearch 2.0. Will be removed in the next major version of NEST")]
3030
long? PreOffset { get; set; }
3131

32-
[JsonProperty("post_offset")]
32+
[Obsolete("Removed in Elasticsearch 2.0. Will be removed in the next major version of NEST")]
3333
long? PostOffset { get; set; }
3434

35+
[JsonProperty("offset")]
36+
double? Offset { get; set; }
37+
3538
[JsonProperty("missing")]
3639
double? Missing { get; set; }
3740
}
@@ -46,6 +49,7 @@ public class HistogramAggregation : BucketAggregationBase, IHistogramAggregation
4649
public ExtendedBounds<double> ExtendedBounds { get; set; }
4750
public long? PreOffset { get; set; }
4851
public long? PostOffset { get; set; }
52+
public double? Offset { get; set; }
4953
public double? Missing { get; set; }
5054

5155
internal HistogramAggregation() { }
@@ -72,8 +76,10 @@ public class HistogramAggregationDescriptor<T>
7276
ExtendedBounds<double> IHistogramAggregation.ExtendedBounds { get; set; }
7377

7478
long? IHistogramAggregation.PreOffset { get; set; }
75-
79+
7680
long? IHistogramAggregation.PostOffset { get; set; }
81+
82+
double? IHistogramAggregation.Offset { get; set; }
7783

7884
double? IHistogramAggregation.Missing { get; set; }
7985

@@ -102,9 +108,13 @@ public HistogramAggregationDescriptor<T> OrderDescending(string key) =>
102108
public HistogramAggregationDescriptor<T> ExtendedBounds(double min, double max) =>
103109
Assign(a => a.ExtendedBounds = new ExtendedBounds<double> { Minimum = min, Maximum = max });
104110

105-
public HistogramAggregationDescriptor<T> PreOffset(long preOffset) => Assign(a => a.PreOffset = preOffset);
111+
[Obsolete("Removed in Elasticsearch 2.0. Will be removed in the next major version of NEST")]
112+
public HistogramAggregationDescriptor<T> PreOffset(long preOffset) => this;
106113

107-
public HistogramAggregationDescriptor<T> PostOffset(long postOffset) => Assign(a => a.PostOffset = postOffset);
114+
[Obsolete("Removed in Elasticsearch 2.0. Will be removed in the next major version of NEST")]
115+
public HistogramAggregationDescriptor<T> PostOffset(long postOffset) => this;
116+
117+
public HistogramAggregationDescriptor<T> Offset(double offset) => Assign(a => a.Offset = offset);
108118

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

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)