Etienne
Etienne

Reputation: 181

ElasticSearch : boost popularity AND date

as in https://www.elastic.co/guide/en/elasticsearch/guide/current/boosting-by-popularity.html I want to boost my search result by their popularity.

BUT I also want to boost the more recent.

I had the idea to combine this request with the one of RobMaters : Is it possible to boost 'newest' items using elasticsearch? (FOQElasticaBundle)

I have the feeling it's kind of weird to boost the popularity in some way (the fiels value factor function) ant the date in another (directly in the range query) --> Is there a "good" way to do it?

(if it is usefull I use the java api)

Upvotes: 2

Views: 1296

Answers (1)

gilmatic
gilmatic

Reputation: 1864

This is quite old now, but for anyone else that encounters this I would suggest taking a look at this resource: https://www.voxxed.com/2014/12/advanced-scoring-elasticsearch/

You can apply a function_score to the query and provide functions which can boost based on a field's value. A gauss function is a good bet for dates, and a field_value_factor is probably good for a popularity measurement. There is nothing stopping you from combining both as well.

Upvotes: 1

Related Questions