Unfortunately, tame elephants make terrible goblin defenses. Against a squad of melee goblins, about the same amount of goblins and elephants die. Against a squad of marksgoblins, the elephants just all die.
The main problem is that elephants completely ignore goblins until they're attacked. Big cats (jaguars, lions, etc) are much better in that regard, but still tend to not do well against marksgoblins.
Three sieges ago, the goblins attacked with a human caravan in the way. I lost four jaguars total before the goblins fled and/or died.
Two sieges ago, there was no caravan, and I lost around 20 jaguars, although almost enough goblins died to cause them to flee (once I placed a ballista out of scare range, a few (wooden) ballista bolts sent them running).
One siege ago, I just showered them with (wooden) ballista bolts until they ran. Much more efficient.
All in all, I prefer to kill as few goblins as possible to avoid needless goblin gear clutter, especially in the dangerous (elephant-infested) wilderness. I'm thinking about setting up a cage-trap-filled tunnel specifically for goblins to run through, but the problem is that the dwarves and pets will try to go out the same tunnel.
(I just magma'd all my goblin war prisoners in a room right next to the smelters - It helps that they don't resist being dragged from cage to cage, and that a single cage seems to be capable of holding 60+ goblins/elephants/whatever simultaneously (presumably in hammerspace))