Fixed
Details
Assignee
Marko BekhtaMarko BekhtaReporter
Yoann RodièreYoann RodièreComponents
Sprint
NoneFix versions
Priority
Major
Details
Details
Assignee
Marko Bekhta
Marko BekhtaReporter
Yoann Rodière
Yoann RodièreComponents
Sprint
None
Fix versions
Priority
Created March 27, 2023 at 8:48 AM
Updated June 2, 2023 at 1:33 PM
Resolved April 21, 2023 at 7:47 AM
See https://stackoverflow.com/questions/75806530/hibernate-search-6-trying-to-sort-dynamic-fields-with-field-templates-leads-to/75809346?noredirect=1#comment133790227_75809346
It seems the
dynamic_templates
section was dropped as soon as the developer sethibernate.search.schema_management.mapping_file
.While it seems reasonable to ignore most of Hibernate Search’s generated mapping when using a custom mapping (it’s too complex to do merging smartly), I think
dynamic_templates
should be retained if it’s not mentioned in the custom mapping, because it’s complex to get right manually, and because it’s similar toproperties
, which we decided to merge. I wouldn’t mergedynamic_templates
, though: just use the one from the custom mapping if it exists, otherwise use Hibernate Search’s auto-generated one.Similarly, we should probably preserve
dynamic
androuting
inRootTypeMapping
(without trying to merge them: just use the custom one or fall back to Hibernate Search’s generated one) . People wanting to override those can do so easily.In short, I would:
Override
org.hibernate.search.backend.elasticsearch.lowlevel.index.mapping.impl.AbstractTypeMapping#merge
inRootTypeMapping
Implement
RootTypeMapping#merge
this way:Call
super()
to mergeproperties
as before (no change there)For other mapping attributes, uses the custom value if defined, falling back to Hibernate Search’s.
Do not change anything for
PropertyMapping#merge
(no override, no handling of non-`properties` mapping attributes: no change there)We’ll need to update the documentation to reflect those changes: https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#section-field-bridge