Commit 6331e5ea6ae48fee18b8cc7914c2582c00ad392d
1 parent
b31cc20f
Exists in
master
and in
21 other branches
Update README.md
Showing
1 changed file
with
19 additions
and
0 deletions
Show diff stats
README.md
... | ... | @@ -832,6 +832,25 @@ product.reindex |
832 | 832 | product.reindex_async |
833 | 833 | ``` |
834 | 834 | |
835 | +Reindex more than one record without recreating the index | |
836 | + | |
837 | +```ruby | |
838 | +# do this ... | |
839 | +some_company.products.each { |p| p.reindex } | |
840 | +# or this ... | |
841 | +Product.searchkick_index.import(some_company.products) | |
842 | +# don't do the following as it will recreate the index with some_company's products only | |
843 | +some_company.products.reindex | |
844 | +``` | |
845 | + | |
846 | +Reindex large set of records in batches | |
847 | + | |
848 | +```ruby | |
849 | +Product.where("id > 100000").find_in_batches do |batch| | |
850 | + Product.searchkick_index.import(batch) | |
851 | +end | |
852 | +``` | |
853 | + | |
835 | 854 | Remove old indices |
836 | 855 | |
837 | 856 | ```ruby | ... | ... |