Hibernate Search 6 + Elasticsearch(7.16.3) , sorting by not existing property in a single index

Well, sure. But how exactly is Hibernate Search supposed to guess that unmapped_type should be set to keyword and not, say, integer? The answer is, it cannot, because Hibernate Search doesn’t know anything about property.A.

So, let’s see why you end up in this situation, because there’s something strange here.

This is the part I don’t get:

Why would the mapping change depending on the data? You could have a mapping with all possible properties, and index documents that happen not to use those properties at any point.

Evidently, you need these properties in the mapping at search time, because you use them, so it’s not like they are useless in your mapping. So, why are you using an empty mapping?

I suspect you’re using dynamic mapping to some extent, but I’m not sure how you’re using it exactly. And this the crux of the problem, because Hibernate Search 6 is able to handle dynamic mappings, but it requires specific care.

What is your mapping on the Hibernate Search side (annotations, bridges)?