Bring water and vinegar to a boil in a pot, then reduce heat to low.
Add garlic, salt, sugar, red pepper flakes, black peppercorns, bay leaf, mustard seeds, and coriander seeds. Simmer for 5 minutes.
Add shrimp to the pot and cook for 2-3 minutes until they turn pink and are just cooked through.
Remove from heat and let cool for 10 minutes.
Add the sliced onion to a jar and pour the shrimp mixture over it.
Seal the jar and refrigerate for at least 24 hours before serving.
