Most likely you have a piece of the meniscus that has torn or is floating around in your knee.
Hot then cold and get weight off of it for a bit.
If swelling is going on it might go down after treatment.
If not get it checked out because it will not fix itself.
I have had both cleaned out and have not had a problem after.
Hope it gets better on its own.