I am trying to boost query for the most recent posts on my classified website.
When I add this code there were no results, I am not sure why.
//boost recent posts
$date0 = new \DateTime("NOW");
$date1 = new \DateTime("-1 month");
$params['body']['query']['bool']['must'][]['bool']['should']['range']['timestmp_created_at']
= array (
'boost' => '12',
'gte' => $date1->getTimestamp(),
'lt' => $date0->getTimestamp(),
);
$date2 = new \DateTime("-3 month");
$params['body']['query']['bool']['must'][]['bool']['should']['range']['timestmp_created_at']
= array (
'boost' => '9',
'gte' => $date2->getTimestamp(),
'lt' => $date1->getTimestamp(),
);
$date3 = new \DateTime("-6 month");
$params['body']['query']['bool']['must'][]['bool']['should']['range']['timestmp_created_at']
= array (
'boost' => '6',
'gte' => $date3->getTimestamp(),
'lt' => $date2->getTimestamp(),
);
$date4 = new \DateTime("-12 month");
$params['body']['query']['bool']['must'][]['bool']['should']['range']['timestmp_created_at']
= array (
'boost' => '3',
'gte' => $date4->getTimestamp(),
'lt' => $date3->getTimestamp(),
);
$date4 = new \DateTime("-12 month");
$params['body']['query']['bool']['must'][]['bool']['should']['range']['timestmp_created_at']
= array (
'boost' => '1',
'lt' => $date4->getTimestamp(),
);
Why doesn't this work?