Using Elasticsearch as a recommendation engine


(Bruno Miranda) #1

Does anybody have experience using Elasticsearch as a recommendation engine? I have several functions within a function_score block to boost the score based on filters. More interestingly I am using field_value_factor (to alter score based on document values) and a gauss function achieve "the closer, the better" functionality. I was curious if this approach is the recommended approach. And any pointers.


(Thomas Decaux) #2

Usually recommendation means machine learning, what is your approach?


(Bruno Miranda) #3

I have a basic set of rules that determined which documents would score higher than others. Example:

Say I am searching for articles posted by users within a social network.

  1. Articles posted by my friends would boost the score of the document.
  2. Articles posted by a friend of a friend would have a slightly lesser boost impact
  3. Articles posted by someone near me would be the an even slightly lesser impact but one nonetheless.

The above is a simplify version of what I am doing. I use a terms filter using a list of my friend ids, friend of friends ids and a geo_distance filter for the number 3.

Makes sense?


(Thomas Decaux) #4

Okay I see, yes it's a very good approach.

I think you can hack ES if you want to score by an external data source, instead of storing friend list. Or you could use Apache Spark for that (because its low latency).

Do you have mapping/document/queries examples somewhere ?


(Bruno Miranda) #5

I don't yet, but I am using a terms filter lookup to avoid sending large arrays of ids over HTTP.


(Mark Harwood) #6

Just curious - are you searching only via friend-of-friend type connections ("what is my social circle generally interested in?") or are you also testing properties of the docs e.g. free-text search on the contents ("find me docs on 'clubs' my friends like).


(Bruno Miranda) #7

Hi Mark,

I am mostly using filters on the docs, ie.: find documents where some ID matches my query id. I may add so full-text search capabilities to it in the future. I have also used full-text search in conjunction with the function_score mentioned above.

I've always wondering if other people are using it this way for purposes similar to mine.


(system) #8