In the past, when your stomach was upset, you were told to eat a bland diet — maybe even the super bland BRAT diet of bananas, white rice, applesauce, and unbuttered white toast. The thinking was that spicy or even flavorful foods could irritate the digestive tract, causing more upset, including vomiting, diarrhea, and ulcers.

But those assumptions probably made more than one person wonder how people in cultures where spicy food is consumed every day, and where it is even sometimes considered a medicine, took care of their stomachs.

It turns out that not all spices are bad for your stomach, and in fact, some are just what the doctor ordered.

“There’s really not a lot of research to say those hot foods are bad for the entire digestive tract,” says Rene Ficek, R.D., the lead nutrition expert at Seattle Sutton’s Healthy Eating.

First, a seemingly simple question: What is a spicy food? The answer to that is complicated, since “spicy” is a relative term. Peppermint toothpaste may burn some palates, while other folks can eat Thai peppers straight from the vine without breaking a sweat.

Most hot spices are derived from a pepper or chili plant, though some plant leaves, like mustard greens, are also spicy, and so are some roots, like ginger. We incorporate these spices into our foods in raw, cooked, dried, and ground form. One common spice some people think of as hot, curry, is actually a combination of several spices, including curry plant leaves, ginger, and chili.

“A lot of people associate spicy food with gastroesophageal reflux disease (GERD),” says Ficek. “But there are many other foods that are worse gastric irritants, including caffeine, alcohol, and acidic citrus fruits.” If you experience digestive discomfort after eating spicy foods, you might be reacting to something other than the spice in your dinner.

Mexican foods often use chili and pepper in their recipes, but your stomach could be reacting to fat from cheese or butter-based sauces. Acidic, tomato-based pasta sauce or the lemon in a dish of chicken piccata could be eating away at your digestive tract lining.

It seems that spices have many health benefits. According to studies, chili, ginger, and other spices can reduce inflammation and treat gastric infections. “We do know that a lot of spices are a great source of vitamin C, which can reduce duration of the common cold and might affect cancer and heart disease,” says Ficek. Some spices seem to reduce inflammation, an immune reaction in which affected parts of the body become swollen. Inflammation is a part of many different types of illness, including discomfort of the digestive tract.

And contrary to long-held belief, spicy foods don’t cause ulcers. In fact, capsaicin, the chemical that gives chilies and peppers their kick, has been shown to inhibit the bacteria H. pylori, the most common cause of ulcers. Capsaicin has an interesting relationship to pain: The initial irritation of capsaicin is followed by a numbing effect. That’s why it’s used in topical treatments in cream or as a dermal patch for joint and other pain. Resiniferatoxin, a variant of capsaicin, is used as an injected pain reliever.

Most people would consider the spice turmeric to be more bitter than hot, but it is included in many recipes for spicy dishes, like curries. The active constituent of turmeric, curcumin, has been shown to have some significant health properties. It shows promise in treating irritable bowel syndrome and general digestive discomfort by blocking specific pain receptors. Curcumin also has demonstrated effectiveness in preventing and treating colorectal cancer.

If you already have ulcers, you may find that spicy foods make them feel worse. Spicy foods can also irritate some urinary tract infections, and certainly will cause your nose to run and eyes to water, which could bring on sinus irritation.

The best thing about enjoying spicy foods as a digestive aid is that they taste good. As a practical consideration, you can adjust how much spice to add to foods when you cook at home, dialing your heat level up or down in accordance with your taste.