Beans have starches that the body cannot easily digest. This is what causes most people to get gas.
Soak the beans prior to cooking and discard the water. This cleans away some of the starches. However, nutrients are also lost in the water.
After boiling the beans for a while, discard 1/4 cup of the water. Replace it with 1/4 cup of apple cider vinegar. Heat the beans until boiling again.