In 5, we allow multi-valued sort fields at indexing time, because we don’t know those fields will be multi-valued. But we don’t have any way to sort on such fields.
We need to either:
Inspect metadata at query time to prevent sorts on multi-valued fields and throw an explicit exception.
OR provide ways to sort on multi-valued fields: allow to specify “sort on the max for each document” or similar.
For reference:
Solr forces users to declare multi-valued fields in the schema
Elasticsearch does not
Both allow to sort on multi-valued fields (Solr since 5.3: https://lucidworks.com/2015/09/10/minmax-on-multivalued-field/)