# Boosting results by date

**URL:** <https://discuss.elastic.co/t/boosting-results-by-date/5312>\
**Category:** Elasticsearch\
**Created:** [September 5, 2011, 3:51pm UTC](https://discuss.elastic.co/t/boosting-results-by-date/5312 "2011-09-05T15:51:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tania](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tania/32/3123_2.png) [@Tania](https://discuss.elastic.co/u/Tania)\
**Post date:** [September 5, 2011, 3:51pm UTC](https://discuss.elastic.co/t/boosting-results-by-date/5312/1 "2011-09-05T15:51:36Z")

</div>

Hi all,  
I posted this topic one month ago but there were no related replies. I am  
interested in boosting my results by more recent date, this  
is, modifying they score so as to _newer documents have a slightly bigger  
score than older ones_ (notice that I _don't mean sorting by  
date_).  
I do know that I can't modify the score in runtime, so it becomes quite  
difficult.  
I have discovered new features in ES so it may be easier to achieve it right  
now. Maybe I could use a _boosting query_ to enhance the more recent ones  
and to demote the older ones. Is it a good idea?  
Any help is appreciated! Thanks!  
Tania

---

<div class="post-metadata">

**Author:** ![philwhln](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/philwhln/32/3121_2.png) [@philwhln](https://discuss.elastic.co/u/philwhln)\
**Post date:** [September 5, 2011, 4:50pm UTC](https://discuss.elastic.co/t/boosting-results-by-date/5312/2 "2011-09-05T16:50:40Z")

</div>

Hi Tania,

Doing this at a fine grain level will be harder than doing this roughly.

For instance, you could do this by month by storing a month field (eg.  
"201101".."201112", "201001".."201012", "200901".."200912") and boosting  
this field at query time on the terms closest to today. For instance, today  
I'd boost "201109" the most, "201108" a little less and "201107" a little  
less still.

You can do this at a more granular level, but it means passing more query  
terms to the search.

Cheers,  
Phil

On Mon, Sep 5, 2011 at 8:51 AM, Tania [yosoythania@hotmail.com](mailto:yosoythania@hotmail.com) wrote:

> Hi all,  
> I posted this topic one month ago but there were no related replies. I am  
> interested in boosting my results by more recent date, this  
> is, modifying they score so as to _newer documents have a slightly bigger  
> score than older ones_ (notice that I _don't mean sorting by  
> date_).  
> I do know that I can't modify the score in runtime, so it becomes quite  
> difficult.  
> I have discovered new features in ES so it may be easier to achieve it  
> right now. Maybe I could use a _boosting query_ to enhance the more recent  
> ones and to demote the older ones. Is it a good idea?  
> Any help is appreciated! Thanks!  
> Tania

---

<div class="post-metadata">

**Author:** ![Joel\_Abrahamsson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joel_abrahamsson/32/1924_2.png) [@Joel\_Abrahamsson](https://discuss.elastic.co/u/Joel_Abrahamsson)\
**Post date:** [September 5, 2011, 5:01pm UTC](https://discuss.elastic.co/t/boosting-results-by-date/5312/3 "2011-09-05T17:01:04Z")

</div>

Hi,

I'm not sure about the performance, but maybe a custom\_score query  
could be used with a script that (roughly) divides the \_score with the  
result of the current day minus the days in the date field?

/Joel

On 5 Sep, 18:50, Phil Whelan [phil...@gmail.com](mailto:phil...@gmail.com) wrote:

> Hi Tania,
> 
> Doing this at a fine grain level will be harder than doing this roughly.
> 
> For instance, you could do this by month by storing a month field (eg.  
> "201101".."201112", "201001".."201012", "200901".."200912") and boosting  
> this field at query time on the terms closest to today. For instance, today  
> I'd boost "201109" the most, "201108" a little less and "201107" a little  
> less still.
> 
> You can do this at a more granular level, but it means passing more query  
> terms to the search.
> 
> Cheers,  
> Phil
> 
> On Mon, Sep 5, 2011 at 8:51 AM, Tania [yosoytha...@hotmail.com](mailto:yosoytha...@hotmail.com) wrote:
> 
> > Hi all,  
> > I posted this topic one month ago but there were no related replies. I am  
> > interested in boosting my results by more recent date, this  
> > is, modifying they score so as to _newer documents have a slightly bigger  
> > score than older ones_ (notice that I _don't mean sorting by  
> > date_).  
> > I do know that I can't modify the score in runtime, so it becomes quite  
> > difficult.  
> > I have discovered new features in ES so it may be easier to achieve it  
> > right now. Maybe I could use a _boosting query_ to enhance the more recent  
> > ones and to demote the older ones. Is it a good idea?  
> > Any help is appreciated! Thanks!  
> > Tania

---

<div class="post-metadata">

**Author:** ![Tania](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tania/32/3123_2.png) [@Tania](https://discuss.elastic.co/u/Tania)\
**Post date:** [September 6, 2011, 7:18am UTC](https://discuss.elastic.co/t/boosting-results-by-date/5312/4 "2011-09-06T07:18:22Z")

</div>

Yes, my first intention was to use custom\_score but the performance was  
extremely poor.  
I would check boosting queries according to Phil's answer. Thanks a lot  
guys! I would post when I find an appropriate solution.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [September 6, 2011, 10:15am UTC](https://discuss.elastic.co/t/boosting-results-by-date/5312/5 "2011-09-06T10:15:59Z")

</div>

What was the formula that you used to boost by date in this case?

On Tue, Sep 6, 2011 at 10:18 AM, Tania [yosoythania@hotmail.com](mailto:yosoythania@hotmail.com) wrote:

> Yes, my first intention was to use custom\_score but the performance was  
> extremely poor.  
> I would check boosting queries according to Phil's answer. Thanks a lot  
> guys! I would post when I find an appropriate solution.

---

<div class="post-metadata">

**Author:** ![Rob\_Masters](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rob_masters/32/2737_2.png) [@Rob\_Masters](https://discuss.elastic.co/u/Rob_Masters)\
**Post date:** [August 23, 2012, 2:24pm UTC](https://discuss.elastic.co/t/boosting-results-by-date/5312/6 "2012-08-23T14:24:49Z")

</div>

Hi Tania, apologies for bumping an old question but I'm trying to achieve exactly  
the same thing[http://stackoverflow.com/questions/12091365/is-it-possible-to-boost-newest-items-using-elasticsearch-foqelasticabundle](http://stackoverflow.com/questions/12091365/is-it-possible-to-boost-newest-items-using-elasticsearch-foqelasticabundle) at  
the moment and haven't found any examples of this, which I'd have thought  
is a very common requirement. Would you mind sharing what your solution  
was, assuming you found one and that you can remember that far back.

Thanks

On Tuesday, 6 September 2011 08:18:22 UTC+1, Tania wrote:

> Yes, my first intention was to use custom\_score but the performance was  
> extremely poor.  
> I would check boosting queries according to Phil's answer. Thanks a lot  
> guys! I would post when I find an appropriate solution.

--

---

<div class="post-metadata">

**Author:** ![Rob\_Masters](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rob_masters/32/2737_2.png) [@Rob\_Masters](https://discuss.elastic.co/u/Rob_Masters)\
**Post date:** [September 6, 2012, 12:18pm UTC](https://discuss.elastic.co/t/boosting-results-by-date/5312/7 "2012-09-06T12:18:19Z")

</div>

Solution:

> <https://stackoverflow.com/questions/12091365/is-it-possible-to-boost-newest-items-using-elasticsearch-foqelasticabundle/12299806#12299806>

On Thursday, 23 August 2012 15:24:49 UTC+1, Rob Masters wrote:

> Hi Tania, apologies for bumping an old question but I'm trying to achieve exactly  
> the same thing[http://stackoverflow.com/questions/12091365/is-it-possible-to-boost-newest-items-using-elasticsearch-foqelasticabundle](http://stackoverflow.com/questions/12091365/is-it-possible-to-boost-newest-items-using-elasticsearch-foqelasticabundle) at  
> the moment and haven't found any examples of this, which I'd have thought  
> is a very common requirement. Would you mind sharing what your solution  
> was, assuming you found one and that you can remember that far back.
> 
> Thanks
> 
> On Tuesday, 6 September 2011 08:18:22 UTC+1, Tania wrote:
> 
> > Yes, my first intention was to use custom\_score but the performance was  
> > extremely poor.  
> > I would check boosting queries according to Phil's answer. Thanks a lot  
> > guys! I would post when I find an appropriate solution.

--

---

<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:** [July 6, 2017, 3:13am UTC](https://discuss.elastic.co/t/boosting-results-by-date/5312/8 "2017-07-06T03:13:55Z")

</div>


