Skip to content

deprecate PreOffset and PostOffset and introduced Offset #2845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions src/Nest/Aggregations/Bucket/Histogram/HistogramAggregation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@ public interface IHistogramAggregation : IBucketAggregation
[JsonProperty("extended_bounds")]
ExtendedBounds<double> ExtendedBounds { get; set; }

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

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

[JsonProperty("offset")]
double? Offset { get; set; }

[JsonProperty("missing")]
double? Missing { get; set; }
}
Expand All @@ -46,6 +49,7 @@ public class HistogramAggregation : BucketAggregationBase, IHistogramAggregation
public ExtendedBounds<double> ExtendedBounds { get; set; }
public long? PreOffset { get; set; }
public long? PostOffset { get; set; }
public double? Offset { get; set; }
public double? Missing { get; set; }

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

long? IHistogramAggregation.PreOffset { get; set; }

long? IHistogramAggregation.PostOffset { get; set; }

double? IHistogramAggregation.Offset { get; set; }

double? IHistogramAggregation.Missing { get; set; }

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

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

public HistogramAggregationDescriptor<T> PostOffset(long postOffset) => Assign(a => a.PostOffset = postOffset);
[Obsolete("Removed in Elasticsearch 2.0. Will be removed in the next major version of NEST")]
public HistogramAggregationDescriptor<T> PostOffset(long postOffset) => this;

public HistogramAggregationDescriptor<T> Offset(double offset) => Assign(a => a.Offset = offset);

public HistogramAggregationDescriptor<T> Missing(double missing) => Assign(a => a.Missing = missing);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public HistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) :
order = new
{
_key = "desc"
}
},
offset = 1.1
}
}
}
Expand All @@ -40,6 +41,7 @@ public HistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) :
.Interval(100)
.Missing(0)
.Order(HistogramOrder.KeyDescending)
.Offset(1.1)
)
);

Expand All @@ -51,7 +53,8 @@ public HistogramAggregationUsageTests(ReadOnlyCluster i, EndpointUsage usage) :
Field = Field<Project>(p => p.NumberOfCommits),
Interval = 100,
Missing = 0,
Order = HistogramOrder.KeyDescending
Order = HistogramOrder.KeyDescending,
Offset = 1.1
}
};

Expand Down