Skip to content

Basic steps for a simple spark-elasticsearch als recipe recommender

Notifications You must be signed in to change notification settings

Yiling-J/spark-elasticsearch-recommender-basic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

spark-elasticsearch-recommender-basic

Basic steps for a simple spark-elasticsearch als recipe recommender

Installation

apache-spark 2.1.1

elasticsearch 5.5.1

logstash 5.5.1

Steps

  1. Training your model and export factor matrix to database. See: recipe_recommender.py

  2. Using logstash to export data to elasticsearch. See: logstash.conf

  3. Using elasticsearch api with painless script_score to get results by custom ordering

POST http://127.0.0.1:9200/recipes/_search
{
  "query": {
    "function_score": {
      "script_score": {
        "script": {
          "inline": "double total = 0; for (int i = 0; i < doc['vector'].length; ++i) { total += doc['vector'][i] * params.factor[i]; } return total;",
          "params": {
            "factor": <factor from user_factor table>
          }
        }
      }
    }
  }
}

About

Basic steps for a simple spark-elasticsearch als recipe recommender

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages