2

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)

Community
  • 1
  • 1
Etienne
  • 181
  • 1
  • 13
  • I can imagine a `bool` query with several `should`s: several using `boost` for `range` queries and another one using the approach for popularity boost. Why weird? – Andrei Stefan Nov 13 '15 at 20:27
  • Just because the "boost" concept is not applied in the same way for the date and the popularity... – Etienne Nov 14 '15 at 14:53

1 Answers1

1

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.

gilmatic
  • 1,764
  • 1
  • 14
  • 16