Some filters have a circular spring retainer that snaps in, some appear to be somehow given a roll crimp to retain the glass, and I believe some have a cement of some sort. Without seeing the situation, I might consider using something relatively benign like white glue in a hypodermic style dispenser to just fill in the gaps, carefully cleaning off any surplus, if it's not a threaded retainer. Years ago I did some work, but not on filters, diluting silicone adhesive with naptha to thin it so it could be applied in very small quantities with a hypodermic needle. At the time, I had access to some fairly exotic industrial adhesives, I'm not 100% sure as to whether it would work with the over the counter home center stuff. I would certainly test first if going that way.