Boost recent documents

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

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' -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