As always with Elephants the key is to make them rampage... Flaming Bacon, and Flaming Projectiles are always your best hope at doing this.

Failing that sustained missile fire is certainly the way to go.

If however you do not have any missile or bacon, you are gonna have it bad. A Phalanx can work but you need to be sure the formation is not disrupted. Also war dogs can be handy for attacking elephants, given the unit's rapid replenishment...

Given your doing an Egyptian campaign I do not see how you are having problems with them. Egypt's bowmen unit has more men per unit than other factions... This means more arrows.

mass-target the Elephants with fire arrows from multiple bowmen and soon enough the stampede will begin... Then you can send some desert cav to hit them in the rear and wear them down (desert cav again has more men in the unit).