Skip to content

code-ops-show/moviedb

Repository files navigation

moviedb

Example App for Elasticsearch Series on Codemy.net

Dependencies

  • PostgreSQL 9.3+
  • Elasticsearch 1.7+
  • Redis 2.8+

Setup

Copy database.yml.example as database.yml then run

rake db:create db:schema:load

You will need to download the example data dump from here Data Dump

Once you have the dump file run this command to import it into your local database

pg_restore --verbose --clean --no-acl --no-owner -h localhost -U user -d yourdb moviedb_development.dump

Once you have the data in your database you will need to index it into your elasticsearch

rails c

Once you are in the console use this, snippet of code. It will queue all the movies in the database for indexing.

Movie.find_each do |m|
  m.index_document
end

Start your sidekiq process so it runs the actual indexing

bundle exec sidekiq -q elasticsearch