Elephants and chariots are both meant to repeatedly charge through to bust up the enemy formation. Getting either stuck in melee is stupid and will often get them killed. Although animations of eles tossing people in the air is fun, it will get them routed or killed.

Exploit the gaps and disorder with cav or a timely infantry charge. Cavalry works best at the troops that are run over by the elephants are stunned and temporarily unable to respond. While eles by themselves might not kill much, follow up by cav results in massacre and insta rout in most cases.