It depends on if you've trained with them and how your gut reacted when you did, more than anything else. 5 is on the high side, but not unreasonable, and it is really up to you and your needs.
For me, I find that a single gel is plenty for me in a half marathon if I'm well fuelled beforehand, and I don't take it all at once - maybe 3 sips at 12km, 15km, 18km.
In a marathon, I'd take half a gel approx every 5km from the 10k mark. It is good to take in fuel early, but I found this has been early enough for me, again depending on how well-fuelled I am. So in a marathon 4 full gels - but not a full gel at once. I found that my stomach preferred that and processed it easier. I have never had any GI issues in any race.
5 gels with a full gel taken at one go would feel a lot to me, but go with what you've trained on. You'll know for certain then, by experience.
A good plan to have at least 1 on your person though - you never know. Tables can be poorly stocked, you can miss one, etc.