-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| using System; | ||
| using Elasticsearch.Net; | ||
|
|
||
| namespace Nest | ||
| { | ||
| public class IpRangeAttribute : RangePropertyAttributeBase, IIpRangeProperty | ||
| { | ||
| public IpRangeAttribute() : base(RangeType.IpRange) { } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| using System; | ||
| using Elasticsearch.Net; | ||
| using Newtonsoft.Json; | ||
|
|
||
| namespace Nest | ||
| { | ||
| [JsonObject(MemberSerialization.OptIn)] | ||
| public interface IIpRangeProperty : IRangeProperty { } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👎 |
||
|
|
||
| public class IpRangeProperty : RangePropertyBase, IIpRangeProperty | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👎 |
||
| { | ||
| public IpRangeProperty() : base(RangeType.IpRange) { } | ||
| } | ||
|
|
||
| public class IpRangePropertyDescriptor<T> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👎 |
||
| : RangePropertyDescriptorBase<IpRangePropertyDescriptor<T>, IIpRangeProperty, T>, IIpRangeProperty | ||
| where T : class | ||
| { | ||
| public IpRangePropertyDescriptor() : base(RangeType.IpRange) { } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| using Nest; | ||
| using Tests.Framework; | ||
|
|
||
| namespace Tests.Mapping.Types.Core.Range.IpRange | ||
| { | ||
| public class IpRangeTest | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👎 |
||
| { | ||
| [IpRange] | ||
| public Nest.IpAddressRange Range { get; set; } | ||
| } | ||
|
|
||
| [SkipVersion("<5.5.0", "ip range type is a new 5.5.0 feature")] | ||
| public class IpRangeAttributeTests : AttributeTestsBase<IpRangeTest> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👎 |
||
| { | ||
| protected override object ExpectJson => new | ||
| { | ||
| properties = new | ||
| { | ||
| range = new | ||
| { | ||
| type = "ip_range" | ||
| } | ||
| } | ||
| }; | ||
| } | ||
| } | ||
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 withIpAddressRange?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.
👎