What is the difference between –query and –filter in aws cli? What is suggested to use?

I'm starting to learn aws cli and I just wanted to know the difference between --query Y --filter in aws cli? When should we use --query Y --filter options?