Right Side Flank Pain

I have been experiencing some crazy right side pain..like flank area / up under or behind my ribs..  I do not think it's gallbladder related as it has been off and on since 2011.. Here recently tho it's gotten way worse and last for days. Severely Crazy bloating - but no other symptoms other than a little weight gain.. I was curious if anyone can relate; and if this type of pain could be associated with endometriosis. ?? Any advise ?...