The issue or bacteria you are referring to is H-Pylori, most people have this bacteria in the stomache for years and not know it, it can be detected either by stool sample or Endoscopy tissue sample, it causes the same symptoms you have, although so does other problems like IBS and Gallblatter issues, have you taken any Anti-Biotics within the last 6 months or prior to symptoms had a colonoscopy, because when you have H-Pylori bacteria, and you go on anti-biotics, the anti-biotic kills all the bacteria in your stomach, the H-Pylori hides out, and the good bacteria that keeps the H-Pylori in check is gone, now the H-Pylori multiplies and creates al these digestive issues, the only way to get rid of the H-Pylori now, is to go back on a ten day regimen of two types of Anti-Biotics and a PPI (Acid Pump Prohibitor) The trick is to go to a health food store and purchase a good "ProBiotic" and take these daily with the Anti-biotic treatment, this way the probiotic replaces the good bacteria that the Anti-biotic Kills. Good Luck FTB4
There are all kinds of causes for your symptoms. You could have the bad bacteria in your intestines (I can't think of the name for that). They can do a test on that. If your constipation is chronic, they also can run certain tests for that too. It does not appear that a gastro doctor has done a complete work up on you. I would go back, let them know you are not better and need more testing done. As for the headaches, if it's related, I don't know. If not related, could be almost anything - should get a workup for that too.
Just from the symptoms you describe, it sounds like IBS. You may want to discuss this with your GI doctor as there are medications to ease the symptoms. How is your BP? Often a one sided headache can be caused by high BP, also eye strain, sinuses, or ear problems.