Surgery was any procedure performed on a patient often resulting in opening or closing of the body; it was usually performed with the hope of improving the health of the person operated on. It was commonly performed by a surgeon.
Cosmetic surgery was one type used to make one species look like another. (ENT: "Detained", "The Seventh"; TOS: "The Enterprise Incident"; TNG: "Who Watches The Watchers"; DS9: "Sons of Mogh"; VOY: "Faces")
Exploratory surgery was often used by a doctor to assist in diagnosing a patient, such as by Doctor Julian Bashir when he attempted to determine the cause of the sudden generosity of the Grand Nagus. (DS9: "Prophet Motive")