Hi, I was trying to use the flattened field type for one of my fields in my entity ( Flattened datatype | Elasticsearch Guide [7.3] | Elastic), this field type has been introduced at ES 7.3 version. I was unable to find suitable example in documentation and tried to find available methods in the library but lucked out there as well.
Is there existing support for this on the latest version of the library? If not, can a feature request be raised?
Thanks
This is no supported out of the box. However, you can define a custom binder that leverages native Elasticsearch types.
The main drawback is that any search predicate targeting that field will also need to be defined using JSON, because Hibernate Search cannot know how to handle native types during search.
Alternatively, you can leverage field templates, which will get you a similar behavior, but with the advantage that Hibernate Search knows how to handle predicates on such fields, so you won’t necessarily have to use native predicates during search.
You can of course open a feature request, but I suspect there are many more popular/widely used features that will get higher priority, thus the flattened
type is unlikely to get supported anytime soon.
Thanks @yrodiere , I will check out the mentioned workarounds and see which one fits and fulfils our requirement. (edit: we are already using dynamic template with field template, but it generates an object type mapping and we encounter a lot of generated mappings for this field on production, which results in cluster updates eventually, hence impacting cluster performance).
I agree that the use case for this feature is rare only, most people would likely to use it to prevent mapping explosion on their Elasticsearch.