Skip to content
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

Implement runtime script ips #60533

Merged
merged 5 commits into from
Aug 5, 2020

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Jul 31, 2020

This implements the ip typed runtime fields. They share a fair bit
with string runtime fields but we represent them as a BytesRef
containing 128 bits so that the comparisons all happen in the same way
as Lucene's InetAddressPoint.

This implements the `ip` typed runtime fields. They share a fair bit
with `string` runtime fields but we represent them as a `BytesRef`
containing 128 bits so that the comparisons all happen in the same way
as Lucene's `InetAddressPoint`.
@nik9000 nik9000 added the :Search/Search Search-related issues that do not fall into other categories label Jul 31, 2020
@nik9000 nik9000 requested a review from javanna July 31, 2020 16:27
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Search)

@elasticmachine elasticmachine added the Team:Search Meta label for search team label Jul 31, 2020
- match: {hits.total.value: 1}
- match: {hits.hits.0._source.timestamp: 1998-04-30T14:31:27-05:00}

# TODO tests for using the ip in a script. there is almost certainly whitelist "fun" here.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to grab this in a follow up because it is going to take some hacking to pass.

@javanna javanna mentioned this pull request Jul 31, 2020
30 tasks
Copy link
Member

@javanna javanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a couple of comments

* Processes query bounds into {@code long}s and delegates the
* provided {@code builder} to build a range query.
*/
public static Query rangeQuery(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

been thinking about these static methods that we are sharing here and there: should we have a better way to formalize the fact that runtime fields share some bits with their corresponding concrete field? e.g. should they share some base class or something along those lines? Or would it make any sense for runtime field type to extend its corresponding concrete field type? probably both are bad ideas, but probably good to look into what the alternatives are.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I talked with @javanna and we decided that we should keep this in mind, but we don't really have a cleaner way to do it for now. There are certainly other ways, but they aren't obviously cleaner.

* reasons to do this:
* <ul>
* <li>{@link Inet4Address}es and {@link Inet6Address} are not comparable with one another.
* That is correct in some contexts, but not for our queries. Our queries most consider the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/most/must ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

import java.io.IOException;
import java.net.InetAddress;

public class ScriptIpScriptDocValues extends ScriptDocValues<String> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double checking that this is the name you meant to use. I struggle to see what this class does

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a pretty terrible name! I talked with @javanna and it will think it over some more. Or more it so it is a bit more obvious.

@nik9000 nik9000 merged commit e98dfcc into elastic:feature/runtime_fields Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants