Filter post_type thumbnail in Search result

If you look at your code, you see that parameters for a WP_Query are defined in $defaults.

There is also 'post_type' => 'any' defined which could be changed to 'post_type' => 'post' to query only for posts, not pages etc.

As you see later on, the search function redefines the post_type to $context based.

After this you could set it back with $defaults['post_type'] = 'post'; or find out how to use $context for your use…

You could also remove post_type from the $defaults-array, as returning only posts is the default behaviour of WP_Query.

Have a look at the Codex to learn more about WP_Query and especially Type Parameters.