Commit 299b5ce6928bccbf2b30853d410daa3698d7fac3

Authored by Andrew Kane
1 parent 0c47d351

Split out method

Showing 1 changed file with 5 additions and 2 deletions   Show diff stats
lib/searchkick/index.rb
... ... @@ -259,6 +259,10 @@ module Searchkick
259 259 @bulk_indexer ||= BulkIndexer.new(self)
260 260 end
261 261  
  262 + def import_before_promotion(index, relation, **import_options)
  263 + index.import_scope(relation, **import_options)
  264 + end
  265 +
262 266 # https://gist.github.com/jarosan/3124884
263 267 # http://www.elasticsearch.org/blog/changing-mapping-with-zero-downtime/
264 268 def reindex_scope(relation, import: true, resume: false, retain: false, async: false, refresh_interval: nil, scope: nil)
... ... @@ -284,8 +288,7 @@ module Searchkick
284 288 # check if alias exists
285 289 alias_exists = alias_exists?
286 290 if alias_exists
287   - # import before promotion
288   - index.import_scope(relation, **import_options) if import
  291 + import_before_promotion(index, relation, **import_options) if import
289 292  
290 293 # get existing indices to remove
291 294 unless async
... ...