@bpintea found another instance where we use FieldAttribute#name instead of FieldAttribute#fieldName; in case of union types (and so far only union types), these two differ with name being a synthetic string like $$field$converted_to$integer whereas fieldName contains the actual name of the field in the index.
C.f. #127225 (comment). As outlined in my comment, I think it'd be best to avoid this bug at compile time, by making our SearchStats require not just Strings for field names, but either EsFields (contained in every FieldAttribute) or a dedicated wrapper class/record like FieldName to be returned by FieldAttribute#fieldName (but not FieldAttribute#name).