Doctors (I think wisely) try to avoid putting patients through colonscopies unless it has become a longterm problem. Basically because the prep is a very VERY unpleasant procedure and the test is expensive too.
However if youre symptoms keep reoccuring, you may end up without a choice.
The colonscopy could rule out a bunch of things. If they find nothing at all, and they cant think of anything else, then they call it IBS.