-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add support for ip_range datatype (Backport of #3202 to 5.x) #3215
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
Conversation
russcam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments
| [JsonProperty(PropertyName = "ranges")] | ||
| IEnumerable<IIpRange> Ranges { get; set; } | ||
| [JsonProperty("ranges")] | ||
| IEnumerable<IIpRangeAggregationRange> Ranges { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert rename; breaks BWC
| { | ||
| public Field Field { get; set; } | ||
| public IEnumerable<IIpRange> Ranges { get; set; } | ||
| public IEnumerable<IIpRangeAggregationRange> Ranges { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert rename; breaks BWC
| Field IIpRangeAggregation.Field { get; set; } | ||
|
|
||
| IEnumerable<IIpRange> IIpRangeAggregation.Ranges { get; set; } | ||
| IEnumerable<IIpRangeAggregationRange> IIpRangeAggregation.Ranges { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert rename; breaks BWC
|
|
||
| public IpRangeAggregationDescriptor<T> Ranges(params Func<IpRangeDescriptor, IIpRange>[] ranges) => | ||
| Assign(a => a.Ranges = ranges?.Select(r => r(new IpRangeDescriptor()))); | ||
| public IpRangeAggregationDescriptor<T> Ranges(params Func<IpRangeAggregationRangeDescriptor, IIpRangeAggregationRange>[] ranges) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert rename; breaks BWC
| public IpRangeAggregationDescriptor<T> Ranges(params Func<IpRangeDescriptor, IIpRange>[] ranges) => | ||
| Assign(a => a.Ranges = ranges?.Select(r => r(new IpRangeDescriptor()))); | ||
| public IpRangeAggregationDescriptor<T> Ranges(params Func<IpRangeAggregationRangeDescriptor, IIpRangeAggregationRange>[] ranges) => | ||
| Assign(a => a.Ranges = ranges?.Select(r => r(new IpRangeAggregationRangeDescriptor()))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert rename; breaks BWC
|
|
||
| namespace Nest | ||
| { | ||
| public class IpRangeAttribute : RangePropertyAttributeBase, IIpRangeProperty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IpAddressRangeAttribute, to align with IpAddressRange?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
| namespace Nest | ||
| { | ||
| [JsonObject(MemberSerialization.OptIn)] | ||
| public interface IIpRangeProperty : IRangeProperty { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIpAddressRangeProperty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
| [JsonObject(MemberSerialization.OptIn)] | ||
| public interface IIpRangeProperty : IRangeProperty { } | ||
|
|
||
| public class IpRangeProperty : RangePropertyBase, IIpRangeProperty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IpAddressRangeProperty ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
| public IpRangeProperty() : base(RangeType.IpRange) { } | ||
| } | ||
|
|
||
| public class IpRangePropertyDescriptor<T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IpAddressRangePropertyDescriptor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
russcam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some small changes for naming consistency
src/Nest/Mapping/Types/Properties.cs
Outdated
| using System.Linq; | ||
| using System.Linq.Expressions; | ||
| using System.Reflection; | ||
| using Elasticsearch.Net; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needed?
|
|
||
| namespace Tests.Mapping.Types.Core.Range.IpRange | ||
| { | ||
| public class IpRangeTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IpAddressRangeTest for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
| } | ||
|
|
||
| [SkipVersion("<5.5.0", "ip range type is a new 5.5.0 feature")] | ||
| public class IpRangeAttributeTests : AttributeTestsBase<IpRangeTest> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IpAddressRangeAttributeTests for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
| namespace Tests.Mapping.Types.Core.Range.IpRange | ||
| { | ||
| [SkipVersion("<5.5.0", "ip range type is a new 5.5.0 feature")] | ||
| public class IpRangePropertyTests : PropertyTestsBase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IpAddressRangePropertyTests for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👎
russcam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This commit adds support for the ip_range datatype.
The existing IpRange type used for IpRangeAggregation renamed to
IpRangeAggregationRange to allow for the introduction of an IpRange type
whose name aligns with other range datatypes.