But all of them get obtained from the database.
The problem is that you’re ignoring half of them. Or rather merging two of them and displaying as one.
Let’s take a look at your code:
while ( $query->have_posts() ) {
$query->the_post(); // <- here you call the_post() first time
$output.='<div class="entry filter_product">';
// and in the next line you call the_post second time
$output.=get_the_post_thumbnail($query->the_post()->ID,'medium');
$output.='<h3 class="title">'.get_the_title().'</h3>';
$output.='</div>';
}
Every time you call the_post method, you tell the loop to go to the next post. So if you call the_post twice in one loop, then you’ll be skipping by two posts, not by one.
You should change this line:
$output.=get_the_post_thumbnail($query->the_post()->ID,'medium');
To this:
$output.=get_the_post_thumbnail(get_the_ID(),'medium');