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
Add new ip_range field type #24433
Add new ip_range field type #24433
Conversation
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.
I left some minor comments but the change looks good to me overall.
} | ||
@Override | ||
public InetAddress parseFrom(RangeFieldType fieldType, XContentParser parser, boolean coerce, boolean included) | ||
throws IOException { |
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.
can you indent so that the throws is not indented at the same level as the content of the block? (similar issues on the below lines)
@Override | ||
public InetAddress parse(Object value, boolean coerce) { | ||
try { | ||
return value instanceof InetAddress ? (InetAddress) value : InetAddress.getByName((String) value); |
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.
can you use InetAddresses.forString
intead, which guarantees it won't do a dns lookup
if (type.equals("date_range")) { | ||
strVal = "1477872000000"; | ||
} else if (type.equals("ip_range")) { | ||
strVal = "/192.168.1.7:/2001:db8:0:0:0:0:0:0"; |
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.
I guess we get this by doing a toString on an InetAddress. Could you make sure we use InetAddresses.toAddrString
instead?
0ac5481
to
48c83b2
Compare
Thanks for the excellent feedback @jpountz. I made the changes and will go ahead and merge tomorrow unless you have any other concerns. |
a3279a9
to
66e5878
Compare
This commit adds support for indexing and searching a new ip_range field type. Both IPv4 and IPv6 formats are supported. Tests are updated and docs are added.
78c1a65
to
549070b
Compare
merged in 0c4eb0a |
This commit adds support for indexing and searching the new
ip_range
field type. Both IPv4 and IPv6 formats are supported. Tests and docs are updated.