Commit d482aec18212730b92b623fccb0bc5303e8523d1

Authored by Andrew Kane
1 parent 807142da

Expose searchkick_import and searchkick_index_options

Showing 1 changed file with 4 additions and 5 deletions   Show diff stats
lib/searchkick/reindex.rb
... ... @@ -17,7 +17,7 @@ module Searchkick
17 17 # check if alias exists
18 18 if Searchkick.client.indices.exists_alias(name: alias_name)
19 19 # import before swap
20   - searchkick_import(index) unless skip_import
  20 + searchkick_import(index: index) unless skip_import
21 21  
22 22 # get existing indices to remove
23 23 old_indices = Searchkick.client.indices.get_alias(name: alias_name).keys
... ... @@ -29,7 +29,7 @@ module Searchkick
29 29 Searchkick.client.indices.update_aliases body: {actions: [{add: {index: new_name, alias: alias_name}}]}
30 30  
31 31 # import after swap
32   - searchkick_import(index) unless skip_import
  32 + searchkick_import(index: index) unless skip_import
33 33 end
34 34  
35 35 index.refresh
... ... @@ -52,9 +52,8 @@ module Searchkick
52 52 @descendents << klass unless @descendents.include?(klass)
53 53 end
54 54  
55   - private
56   -
57   - def searchkick_import(index)
  55 + def searchkick_import(options = {})
  56 + index = options[:index] || searchkick_index
58 57 batch_size = searchkick_options[:batch_size] || 1000
59 58  
60 59 # use scope for import
... ...