Place coriander seeds, peppercorns, cloves, and cinnamon stick in a small spice infuser or tie up in a small sachet made from muslin.
Heat oil in a large saucepan over medium heat. Add onions and cook, stirring occasionally, until tender, about 7 minutes. Add mustard seeds, and cook an additional 2 minutes.
Add pineapple, turmeric, ginger, chili pepper, brown sugar, and vinegar, and bring to a boil. Place sachet in pan so that it's submerged.
Reduce heat and simmer until thickened, about 2 hours.
Pack in a clean jar and refrigerate.