Added possibility to version indexes.
Merged
BO
2y ago+83+83+01234567890123456789-13-13-01234567890123456789
Hi everyone,
This is a simple pr that adds the indexableAs method in the searchable trait.
Why?
- Rolling updates: It ensures zero downtime by indexing data into a new index while searching continues on the old one. This is something I feel is missing from scout, especially for high traffic websites that want to use it and it is quite easy to achieve this way.
- Backwards compatible: users that don't care for this feature wont be affected since by default the indexableAs and searchableAs have the same return.
Usage scenario:
- Users Model is searchable
- You define the indexableAs with return 'users_v2'
- You reimport everything in users_v2, meanwhile your website can still perform searches on the old index
- You deploy a new version of your code with the searchableAs returning 'users_v2'
- profit!