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.rbconcern - and the
searchkick_index.rakeRake task
- Clone this project
- Bundle install it
- Change the
database.ymlfile (here I'm using Postgres) - Run elastic search
- Run Rails' seeds command (
rake db:seed) - For more details, check the
db/seeds.rbfile - This will create Nick and Daniela's users and some posts on their databases
- Run the
rake searchkick:reindex_tenantstask - Now you can search through
Post.searchbased on a multi tenant approach:
Apartment::Tenant.switch('daniela_db')
Post.search('Searchkick').count
# => 1
``