This Rails project is an example of how you could use the Searchkick with the Apartment gem.
The important files here are:
- The
schema_searchable.rb
concern - and the
searchkick_index.rake
Rake task
- Clone this project
- Bundle install it
- Change the
database.yml
file (here I'm using Postgres) - Run elastic search
- Run Rails' seeds command (
rake db:seed
) - For more details, check the
db/seeds.rb
file - This will create Nick and Daniela's users and some posts on their databases
- Run the
rake searchkick:reindex_tenants
task - Now you can search through
Post.search
based on a multi tenant approach:
Apartment::Tenant.switch('daniela_db')
Post.search('Searchkick').count
# => 1
``