# Boost recent documents

**URL:** https://discuss.elastic.co/t/boost-recent-documents/3686
**Category:** Elasticsearch
**Created:** [December 21, 2010, 2:04pm UTC](https://discuss.elastic.co/t/boost-recent-documents/3686 "2010-12-21T14:04:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Joaquin\_Cuenca\_Abela](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@Joaquin\_Cuenca\_Abela](https://discuss.elastic.co/u/Joaquin_Cuenca_Abela)
#### Post date: [December 21, 2010, 2:04pm UTC](https://discuss.elastic.co/t/boost-recent-documents/3686/1 "2010-12-21T14:04:15Z")

</div>

Hi,

I want to be able to boost documents based on a datetime property, to  
give more relevance to more recent documents. Is it possible to do it  
in ElasticSearch?

Thanks!

--  
Joaquin Cuenca Abela

---

<div class="post-metadata">

### Author: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [December 21, 2010, 2:56pm UTC](https://discuss.elastic.co/t/boost-recent-documents/3686/2 "2010-12-21T14:56:06Z")

</div>

On Tue, 2010-12-21 at 15:04 +0100, Joaquin Cuenca Abela wrote:

> Hi,
> 
> I want to be able to boost documents based on a datetime property, to  
> give more relevance to more recent documents. Is it possible to do it  
> in Elasticsearch?

yes - here's an example (you could do it with scripts as well)

curl -XGET '[http://127.0.0.1:9200/\_all/\_search](http://127.0.0.1:9200/_all/_search)' -d '  
{  
"query" : {  
"bool" : {  
"must" : {  
"field" : {  
"\_all" : "foo bar baz"  
}  
},  
"should" : [  
{  
"range" : {  
"publish\_date" : {  
"boost" : 5,  
"gte" : "2010-12-01 00:00:00"  
}  
}  
},  
{  
"range" : {  
"publish\_date" : {  
"lt" : "2010-12-01 00:00:00",  
"boost" : 1  
}  
}  
}  
]  
}  
}  
}  
'

clint

---

<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, 4:15am UTC](https://discuss.elastic.co/t/boost-recent-documents/3686/3 "2017-07-06T04:15:03Z")

</div>


