There are a few options on how to survive an overly difficult fight, but the most basic one would be to run away and live to fight another day. There are few situations where you are forced to fight dragons, and for those rare occasions the quest will provide you a strong companion, the rest of your time you can flee. Run a far enough distance away and fast travel to a city. Once inside the keep's walls you should be safe.
If you simply must defeat an difficult elder dragon while at a medium level there are a few things you can take advantage of. First, turn your difficulty to "Very Low" this will improve the damage you do to others while decreasing the damage enemies can do to you. Of all changes you can make this will be the biggest boon and it comes at no cost to you.
Bring companions, allies, and distractions. If available use companions, many of whom you can find for free, and often scale with your level. They'll be about as strong as you are - effectively doubling your damage output. Allies such as Hold Guards and nearby army encampments can also provide valuable backup. Guards, armies and other allied forces patrol Skyrim, if you know there are some nearby flee to their camp and let them assist with the fighting.
If no allies are available use your enemies instead! Sprint to the nearest bandit camp and let them do the fighting for you. The enemy of my enemy is my friend, right? Beware that you will still need to fight the survivor of the battle, but they should be significantly weakened by the conflict.
If you aren't able to flee or aren't able to find reinforcements of some form it will be an incredibly difficult fight for you. Playing on "Very Easy" should make it winnable, but it will require just as much luck as it does skill. Use terrain such as boulders and trees to block incoming attacks and use any weapons, potions and Shouts available to you. This is a time when the often forgotten fire (or frost) resistance potions should be consumed if you have them; as should magika regen potions or anything else that might help. A fight like this at your level is 50% skill, 50% luck.
If all else fails, reload to an older save before you encountered the dragon.