-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Add index-time scripts to geo_point field mapper #71861
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 geo_point field mapper #71861
Conversation
Pinging @elastic/es-search (Team:Search) |
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 two small comments, and I think that we also need to update the docs for geo_point field. I defer to @iverase for the final LGTM ;)
}); | ||
if (hasScript) { | ||
throw new MapperParsingException("failed to parse field [" + fieldType().name() + "] of type + " + contentType() + "]", | ||
new IllegalArgumentException("Cannot index data directly into a field with a [script] parameter")); |
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.
grr I forgot about the mappers that override parse when I added this to the base class. Is it worth extracting the check to a common method so that it can be called from here?
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 want to rework parse/parseCreateField anyway, as it's very confusing that we have these two methods with the same signature that do almost exactly the same thing. Can we consider this a band-aid until we tidy up in a followup?
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.
sure, anyways the test is unified and tests the error message, so we ensure that it is always the same one
return new GeoPointFieldMapper(name, ft, multiFieldsBuilder.build(this, contentPath), | ||
copyTo.build(), geoParser, this); | ||
} | ||
return new GeoPointFieldMapper(name, ft, geoParser, this); |
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.
is it necessary to use two different constructors with or without the script?
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 class hierarchy of the geo mappers makes things complicated here, but I can change this so that there's just a single constructor at the expense of adding extra params to all the other class constructors if you think it's less confusing.
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 don't have a strong opinion and I cannot judge if it makes things better. Your call ;)
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. The change make sense to me. I agree with @javanna that we need to update docs.
I knew I'd forgotten something in the initial commit :). Thanks for the reviews! |
This commit adds the ability to define an index-time geo_point field with a script parameter, allowing you to calculate points from other values within the indexed document.
This commit adds the ability to define an index-time geo_point field
with a
script
parameter, allowing you to calculate points from othervalues within the indexed document.