-
Notifications
You must be signed in to change notification settings - Fork 25k
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 index-time scripts to IP field mapper #71617
Conversation
Pinging @elastic/es-search (Team:Search) |
public final void runForDoc(int docId, Consumer<InetAddress> consumer) { | ||
runForDoc(docId); | ||
for (int i = 0; i < count; i++) { | ||
consumer.accept(InetAddressPoint.decode(values[i].bytes)); |
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.
Annoyingly, emit takes an InetAddress and encodes it into a BytesRef and this then immediately decodes it back to an InetAddress to pass to the indexer. Possibly as a follow up it might be worth changing the script to store its values as InetAddresses and to decode them for doc values access only?
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.
makes sense to me
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
public final void runForDoc(int docId, Consumer<InetAddress> consumer) { | ||
runForDoc(docId); | ||
for (int i = 0; i < count; i++) { | ||
consumer.accept(InetAddressPoint.decode(values[i].bytes)); |
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.
makes sense to me
* @param context the search execution context | ||
* @return the value fetcher | ||
*/ | ||
static ValueFetcher valueFetcher(FieldValues<?> fieldValues, Function<Object, Object> formatter, SearchExecutionContext context) { |
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.
the plan is to reuse this for dates too?
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.
Exactly
This commit allows you to set 'script' and 'on_script_error' parameters on IP field mappers, meaning that runtime IP fields can be made indexed simply by moving their definitions from the runtime section of the mappings to the properties section.
This commit allows you to set 'script' and 'on_script_error' parameters
on IP field mappers, meaning that runtime IP fields can be made indexed
simply by moving their definitions from the runtime section of the mappings
to the properties section.