Literally endoscopy means “looking inside with a scope (nowadays uses a video camera)” It can be applied to any part of the body. A number of these already have their special terms: “colonoscopy” for the colon (large intestine), “bronchoscopy” for the bronchi (lungs), “cystoscopy” for the bladder, “laryngoscopy” for the larynx (“voicebox,” with trachea [“windpipe”] too ). There are other specific “-oscopies” as well.
For the esophagus + stomach + duodenum (beginning of the small intestine) there’s “esophago-gastro-duodenoscopy,” for which we always say “EGD,” or just simply “endoscopy. Ear-Nose-Throat (ENT) specialists can look up the nose & down the throat; they just say “endoscopy.”
Most of the time we say “Endoscopy” we mean the EGD. The test is done mainly to find ulcers or gastritis and rule out cancer in people with persistent upper abdominal pain (stomach & duodenum) or esophageal disease for those with trouble swallowing. It allows a specialist to see what’s inside, and obtain a biopsy specimen if necessary. In certain cases like abnormal bleeding, treatment can sometimes be performed through the endoscope. No bowel preparation is necessary for an EGD (just nothing-by-mouth for 8 hours before), Risks from the procedure, biopsy, or sedation (it’s not general anesthesia) are possibly serious but very unlikely. Your specialist should be able to cite numbers.