When you sort the terms aggregation on nested or a child or a parent aggregation the on-data-node sorting sorts by "empty" values. This can be masked by a large enough shard_size so it has slipped through our test cases for a while, but this shows the failures. It looks like this is caused because we delay collecting parent and nested until right before we build buckets.
Replaces #53534 and #53570. Both are about error messages trying to sort. You actually can sort now, it just doesn't work 😢.
Relates to #63811.