A doctor mentioned Helicobacter pylori as a possible culprit for both of those symptoms.
H.pylori infection is a latent infection in the human stomach mucous layer (1)(2). This infection is basically asymptomatic. This infection, however, may cause chronic gastritis. Chronic gastritis is also asymptomatic in most people. Heart burn is not a typical sign of chronic gastritis. In addition to chronic gastritis, H.pylori is able to harm the protective layer in the stomach lining. Since the surroundings in stomach are very acidic (pH~2), any damage done to the protective layer predisposes to stomach ulcer since the gastric acid damages the deeper layers of the stomach lining. These ulcers are usually symptomatic and can cause heartburn and pain in the upper abdomen. NSAIDs can harm the protective layer of stomach in the same way as H.pylori and there they predispose to ulcers also.
However, I find it very difficult to believe that helicobacter would cause migraine. There is at least one meta-analysis and a review article on this subject. Both are published in a quite questionable Open Access journal. The studies included in the meta-analysis are all quite low quality studies. Another study conducted on Iran seems quite dubious also. This study has caused some concerns, as can be seen in PubMed.
The causal relationship between H.pylori eradication and migraine can be studied quite easily and safely in large populations. As so, I am suspicious with regard to these studies since there are no randomized controlled trials published in high quality medical journals on this matter.
Are there any efficient tests to determine if one is in fact "infected" with the bacteria?
A quite recent review article in the New England Journal of Medicine outlines the current non-endoscopic diagnostic modalities:
- Serologic test (=a blood sample to assess for h.pylori antigens) is widely available and cheap. Remains positive even after an eradication
- Urea breath test has high positive and negative predictive values. Results are affected by the use of proton pump inhibitors and antibiotics.
- Fecal antigen test has also positive and negative predictive values. No the most convenient test for patients (not surprised).
Are treatments required when there's no presence of stomach ulcers?
There is absolutely no indication to eradicate H.pylori in patients who are totally asymptomatic. The prevalence of H.pylori infection is so high that half of the world total population should be on antibiotics. Moreover, if the eradication of H.pylori is successful, you will receive almost surely within the next weeks. If one is diagnosed with an ulcer, a reflux disease or h.pylori is seen tissue samples obtained during gastroscopy or the reason of dyspepsia is suspected to be H.pylori infection, the eradication is reasonable.