More explicit error messages when attempting to use features specific to value fields on an object field

Description

Currently we essentially tell the user "Unknown field" when they attempt to use a feature that is specific to value fields on an object field, for example a field projection.

That's because internally, for most features, we only consider value fields, so if the field is an object field, we don't see it, and consider it doesn't exist.

For the few features that consider object fields, we have very specific code (see for example LuceneSearchIndexesContext#nestedPathHierarchyForObject).

We should use similar code for object fields and value fields in the Search DSL, so that we can issue better error messages ("this feature is not available on object fields") and so that the code is more robust and straightforward.

This should also simplify the implementation of a fix for HSEARCH-3905.

Environment

None

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Fix versions

Priority

Major
Configure