Rethink the usage of ProjectionConstants to provide better validation of wrongly used strings

Description

As initially raised in : we know accept both String constants for the Elasticsearch backend and the "regular" Lucene backend, but we can't say if the user is using the right constants as they are just strings to us.

It would be interesting to find a way to distinguish the usage, either with typesafety to provide compile-time validation or at least a way to validate these at runtime.

We also need to keep in mind that any stored indexed field is also a valid target for projection, and the most likely use case is to mix the identifiers from either set of constants and the field names: would be great to be able to validate projection of field names too.

Environment

None

Status

Assignee

Guillaume Smet

Reporter

Sanne Grinovero

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Priority

Major