CloudFront url not expiring from cache

If you are having a url with querystring like this:

/yourparentfolder/subfolder/filename.extension?query1=val1&query2=val2

and you want to expire the cache for that url in CloudFront distribution then the solution is to enter this url in the invalidations of your CloudFront distribution to expire the cache:

/yourparentfolder/subfolder/filename.extension*

This will expire the cache for all the versions of url with different querystrings keys.