20k is A LOT of soldiers. Even if only 10% of them can actually target the PCs and only 5% of them roll natural 20 to hit, that's still 100 damage dice per round. You'll want some sort of Wind Wall et cetara to block incoming damage and any bit of DR goes a long way.
I'd say a more reasonable number would be in the 150-200ish well trained soldiers, moving in small groups to avoid the bulk of AoE damage (they are, under experienced command).
The actual number of soldiers notwithstanding though, I think battlefield control spells should come in much more handy than direct-damage ones because once you can isolate a pocket of safety within which you can recuperate/regroup every now and then, it's going to make fighting a lot easier. It's still going to be tedious however = =
Remember, at no point in history (except for the stone ages) did soldiers actually clash head-on into its enemies. Combats were fought in a series of skirmishes involving long-range weapons (slings, javelins and bow/crossbows) and melee combats were extremely coordinated between two armies.