Detect invalid cardinality of fields mapped as DocValues

Description

It appears that a mapping following this structure:

root entity -> oneToMany -> Spatial fields

will attempt to index the spatial coordinates multiple times for the same field name.
Since Spatial now uses DocValues, this is an invalid mapping.

The mapping has always been invalid as the pairs of coordinates would have been indexed in a mixed bag - so impossible to pair up a latitude with its related longitude - yet we didn't throw an exception at runtime when these were not DocValues.

We should detect an illegal cardinality for DocValue fields at boot time, and fail fast.

See also https://forum.hibernate.org/viewtopic.php?f=9&t=1043185

Environment

None

Assignee

Yoann Rodière

Reporter

Sanne Grinovero

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Priority

Major
Configure