My
goldfish will occasionally rub along the sides of the pond or against the stems of the lilies. They will even rub through my fingers if I hang my hand in the water. I guess they get an itch every once in a while just like any other critter. Since they don't have any hands or paws to scratch with, they use what they can. If there are no other signs of illness or distress and they only do it occasionally, it may just be normal. If it happens all the time, it could be a sign of some type of irritation (
ammonia burns is the most common,
ICH, fungus) or parasite (fish lice, flukes, etc). Just keep an eye on them and see how often it happens or if they develop any other symptoms.