-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Return both concrete fields and aliases in DocumentFieldMappers#getMapper. #31671
Return both concrete fields and aliases in DocumentFieldMappers#getMapper. #31671
Conversation
Pinging @elastic/es-search-aggs |
5abd62b
to
52cfa67
Compare
52cfa67
to
ccbc3a1
Compare
I'd say no. We can look into sharing the load. |
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.
Change looks good, but we should have a plan to migrate all tests off the deprecated getFieldMapper method.
Thanks @jpountz for the review. About the deprecated calls in tests: it will still take a bit of time for this feature branch to be ready to merge, and I think that making far-reaching changes right now will increase the chances of merge conflicts. Would you be fine if we updated the tests as a last task before merging? I can add a 'technical debt' item to the meta-issue to make sure we don't drop it. |
@jtibshirani Yes that would work for me. Thanks for tackling this! |
Added an item to the meta-issue. Is this okay to merge, or do you have other thoughts? |
+1 to merge |
…pper. (#31671) * Rename DocumentFieldMappers#getMapper to getFieldMapper. * Introduce a new DocumentFieldMappers#getMapper that returns a Mapper. * Fix an issue around field aliases in geo suggestion contexts. * Make sure a field alias can refer to a percolate query. * Remove easy-to-fix uses of DocumentFieldMappers#getFieldMapper. * Include alias mappers in DocumentFieldMappers#getMappers. * Make sure we detect conflicts between dynamic object mappers and field aliases. * Throw an exception if aliases are specified as the target of copy_to.
…pper. (elastic#31671) * Rename DocumentFieldMappers#getMapper to getFieldMapper. * Introduce a new DocumentFieldMappers#getMapper that returns a Mapper. * Fix an issue around field aliases in geo suggestion contexts. * Make sure a field alias can refer to a percolate query. * Remove easy-to-fix uses of DocumentFieldMappers#getFieldMapper. * Include alias mappers in DocumentFieldMappers#getMappers. * Make sure we detect conflicts between dynamic object mappers and field aliases. * Throw an exception if aliases are specified as the target of copy_to.
…pper. (#31671) * Rename DocumentFieldMappers#getMapper to getFieldMapper. * Introduce a new DocumentFieldMappers#getMapper that returns a Mapper. * Fix an issue around field aliases in geo suggestion contexts. * Make sure a field alias can refer to a percolate query. * Remove easy-to-fix uses of DocumentFieldMappers#getFieldMapper. * Include alias mappers in DocumentFieldMappers#getMappers. * Make sure we detect conflicts between dynamic object mappers and field aliases. * Throw an exception if aliases are specified as the target of copy_to.
…pper. (#31671) * Rename DocumentFieldMappers#getMapper to getFieldMapper. * Introduce a new DocumentFieldMappers#getMapper that returns a Mapper. * Fix an issue around field aliases in geo suggestion contexts. * Make sure a field alias can refer to a percolate query. * Remove easy-to-fix uses of DocumentFieldMappers#getFieldMapper. * Include alias mappers in DocumentFieldMappers#getMappers. * Make sure we detect conflicts between dynamic object mappers and field aliases. * Throw an exception if aliases are specified as the target of copy_to.
* Add basic support for field aliases in index mappings. (#31287) * Allow for aliases when fetching stored fields. (#31411) * Add tests around accessing field aliases in scripts. (#31417) * Add documentation around field aliases. (#31538) * Add validation for field alias mappings. (#31518) * Return both concrete fields and aliases in DocumentFieldMappers#getMapper. (#31671) * Make sure that field-level security is enforced when using field aliases. (#31807) * Add more comprehensive tests for field aliases in queries + aggregations. (#31565) * Remove the deprecated method DocumentFieldMappers#getFieldMapper. (#32148)
* Add basic support for field aliases in index mappings. (#31287) * Allow for aliases when fetching stored fields. (#31411) * Add tests around accessing field aliases in scripts. (#31417) * Return both concrete fields and aliases in DocumentFieldMappers#getMapper. (#31671) * Add documentation around field aliases. (#31538) * Add validation for field alias mappings. (#31518) * Make sure that field-level security is enforced when using field aliases. (#31807) * Add more comprehensive tests for field aliases in queries + aggregations. (#31565) * Remove the deprecated method DocumentFieldMappers#getFieldMapper. (#32148) * Ensure that field aliases cannot be used in multi-fields. (#32219) * Make sure that field aliases count towards the total fields limit. (#32222) * Fix a test bug around nested aggregations and field aliases. (#32287) * Make sure the _uid field is correctly loaded in scripts. * Fix the failing test case FieldLevelSecurityTests#testParentChild_parentField. * Enforce that field aliases can only be specified on indexes with a single type.
This PR updates
DocumentFieldMappers#getMapper
to return both concrete fields and field aliases. Its method signature now has a top-levelMapper
as its return type as opposed to aFieldMapper
.To support incremental changes, there is still a
getFieldMapper
method that returns aFieldMapper
as before. Almost all callers were migrated to use the method that returns aMapper
, except the ~250 instances inserver_test
that require aFieldMapper
. ThegetFieldMapper
method has been marked as deprecated.Updating
DocumentFieldMappers#getMappers
in this way has a few advantages:MappedFieldType
in the wrong way.Mapper
, we force consumers to consider how field aliases should be handled. This also caught a few bugs (see the fixes below around dynamic object mappers and copy_to).Open questions:
FieldMapper
andFieldAliasMapper
, instead of just using the top-levelMapper
. I quickly tried this out and didn't think it made things much cleaner, and also adds complexity to an (already complex) mapper hierarchy. I would be happy to take a more detailed look at it though.