I often hear stories about enemies defeating elephant riders by axing the legs of the elephants.
Does this mean that the commander of the elephant army did not put enough armor on the elephants' legs?
An elephant is a very large animal. Putting the whole animal in armor would cost more in armor than the whole unit would be worth in warfare. (The same armor could be used to protect a large number of men.)
Therefore armor was used, if at all, to protect only the most vital parts of the animal, e.g., the temples. Most of the animal was unprotected. Of course, having men try to cut off their legs subjected the MEN to great risks.
Elephants proved not to be terribly effective in combat because they weren't as easy to control as horses, and would often "rebound" against the attackers. At the battle of zama, for instance, Hannibal relied on elephants to break through the Roman lines, without success.
Elephants were mostly used in war in South Asia. Use of elephants in the Mediterranean and Europe was much rarer and more amateurish.
It was written that when King of Kings of Iran Ardashir I, founder of the Sassanid Empire, fought the Romans he had 700 armored elephants. South Asian war elephant used in battle (instead of for transportation) before cannons became very dangerous were often highly armored. They also often had sword like blades attached to their tusks and swung large swords or chains with their trunks.