# Issue with multi range queries in elastic search

**URL:** <https://discuss.elastic.co/t/issue-with-multi-range-queries-in-elastic-search/241581>\
**Category:** Elasticsearch\
**Created:** [July 17, 2020, 5:50am UTC](https://discuss.elastic.co/t/issue-with-multi-range-queries-in-elastic-search/241581 "2020-07-17T05:50:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CDu2020](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@CDu2020](https://discuss.elastic.co/u/CDu2020)\
**Post date:** [July 17, 2020, 5:50am UTC](https://discuss.elastic.co/t/issue-with-multi-range-queries-in-elastic-search/241581/1 "2020-07-17T05:50:03Z")

</div>

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.

```auto
//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?

---

<div class="post-metadata">

**Author:** ![CDu2020](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@CDu2020](https://discuss.elastic.co/u/CDu2020)\
**Post date:** [July 19, 2020, 2:21pm UTC](https://discuss.elastic.co/t/issue-with-multi-range-queries-in-elastic-search/241581/2 "2020-07-19T14:21:40Z")

</div>

Any help on this boost query?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 16, 2020, 2:21pm UTC](https://discuss.elastic.co/t/issue-with-multi-range-queries-in-elastic-search/241581/3 "2020-08-16T14:21:42Z")

</div>

Closed on August 16, 2020, 2:21pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
