Skip to content

Latest commit

 

History

History
66 lines (45 loc) · 2.69 KB

README.md

File metadata and controls

66 lines (45 loc) · 2.69 KB

🚀 talk-es-for-reco

Demo code for the following talk: "Shaping Elasticsearch for Recommendation System"

📝 Authors

👷‍♂️ Setup

🔧 Local development

In order to create a working environment, the docker is used. To start it, please, follow the next steps.

  1. Launch the docker daemon.
  2. Get to the repository root folder: cd ~/projects/talk-es-for-reco/
  3. Run the docker containers: docker compose up
  4. In another terminal instance, run docker ps, and check that both containers are running:
    1. container-python
    2. container-elasticsearch
  5. In another terminal instance, get into the container with python environment: docker exec -it container-python /bin/bash
  6. Inside the container, run python scripts like this: python <path/to/script.py>

💾 Elasticsearch

In order to set up Elasticsearch indices and upload data into the corresponding indices, run the following command in the container with python environment: python /usr/src/app/scripts/setup.py

🎉 Features

In the repository, two features are introduced: search and recommendation.

1️⃣ Search

The search.py script utilizes the Elasticsearch library to search the 'users' index based on the provided search input.

Usage:

  1. Modify the SEARCH_INPUT variable to specify the search term.
  2. Run the script: python /usr/src/app/scripts/search.py The search results will be printed to the console.

2️⃣ Recommendation

The recommendation.py script utilizes the Elasticsearch to recommend posts to a user based on various factors. It applies a scoring mechanism to rank posts and provide personalized recommendations to the user.

Usage:

  1. Modify the USER_ID variable to specify the user for whom posts should be recommended.
  2. Run the script: python /usr/src/app/scripts/recommendation.py The recommended posts will be printed to the console, sorted from the most relevant to the least relevant one.

🔗 Links