Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate Search (
https://hibernate.atlassian.net/browse/HSEARCH?atlOrigin=eyJpIjoiZmUzZmNh...
) / Bug (
https://hibernate.atlassian.net/browse/HSEARCH-4825?atlOrigin=eyJpIjoiZmU...
) HSEARCH-4825 (
https://hibernate.atlassian.net/browse/HSEARCH-4825?atlOrigin=eyJpIjoiZmU...
) Hibernate Search's dynamic templates are lost when using a custom mapping through
schema_management.mapping_file (
https://hibernate.atlassian.net/browse/HSEARCH-4825?atlOrigin=eyJpIjoiZmU...
)
Issue Type: Bug Assignee: Unassigned Components: backend-elasticsearch Created:
27/Mar/2023 01:48 AM Fix Versions: 6.2.0.Beta1 Priority: Major Reporter: Yoann Rodière (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
See
https://stackoverflow.com/questions/75806530/hibernate-search-6-trying-to...
(
https://stackoverflow.com/questions/75806530/hibernate-search-6-trying-to...
)
It seems the dynamic_templates section was dropped as soon as the developer set
hibernate.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 to properties , which we decided to merge. I
wouldn’t merge dynamic_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}}and {{routing in RootTypeMapping (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
in RootTypeMapping
* Implement RootTypeMapping#merge this way:
* Call super() to merge properties 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_singl...
(
https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_singl...
)
(
https://hibernate.atlassian.net/browse/HSEARCH-4825#add-comment?atlOrigin...
) Add Comment (
https://hibernate.atlassian.net/browse/HSEARCH-4825#add-comment?atlOrigin...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219- sha1:ac3e918 )