Why is an upper endoscopy done?

Many reasons. For a variety of reasons but mostly to evaluate upper GI symptoms such as reflux, abdominal pain, problems swallowing, signs of bleeding (black or bloody stools) nausea with vomiting, weight loss and sometimes diarrhea. We do so trying to diagnosis and treat such problems as gerd, barrett's, ulcers, cancers or celiac.
Variety of reasons. Upper endoscopy allows your doctor to evaluate the configuration and lining of the esophagus, stomach, and duodenum. Problems such as strictures, ulcers, tumors and a variety of infectious and inflammatory conditions can be diagnosed. Endoscopy may be recommended for evaluation of pain, heartburn, difficulty swallowing, or unexplained weight loss or anemia.