es-reindex 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eed6bf0fb22e4ef0644bc07f8044707489dcac19
4
- data.tar.gz: 785f245811cf514f8ccd50fb5bd6b24d91e65b81
3
+ metadata.gz: 0bfec9b90b4f6f60bca9fbc2e31b512e91859ee0
4
+ data.tar.gz: 34d5f1814a05ad2cb3eeee1427bb8fb1126006a0
5
5
  SHA512:
6
- metadata.gz: 6504ac4e4e7b46ba4e00c15bf2d90889e688479389d9ec399e571d67a709caa3324fb65f6b57d38c7f6558dd85acd9a017ebbea3855fb63ef71e40454b43359f
7
- data.tar.gz: c01e98b13e0edcd1c6075827b2236e4666eb5759772c79e60722cfe8bde36062776df149feeaf18c8acc1a15cc032cd0157aeea14d3f14410fd0b6ac3c0ac8a4
6
+ metadata.gz: fa461c5f68ded8c5e1fb03436cc414df23d7c7dd21e8896c29675c21f6d1a5b5114db2a19de2027d0bbd6ccb773441fb9b59781bf1b769b9d60a597e17828ead
7
+ data.tar.gz: 0a7288a5c3a040c061f99bdb32f3153789cf76d13827535f3a2a5f866469d65527e4f85d2df1f184c40506fe01ad8afd47bca3f60c3f05cf23332e4963f84b38
@@ -79,6 +79,7 @@ ESReindex.copy! 'http://my_server/index', 'http://my_server/index_copy',
79
79
 
80
80
  ## Changelog
81
81
 
82
+ + __0.2.1__: [BUGFIX] Improve callback presence check
82
83
  + __0.2.0__: Lots of bugfixes, use elasticsearch client gem, add .reindex! method and callbacks
83
84
  + __0.1.0__: First gem release
84
85
  + __0.0.9__: Gemification, Oj -> MultiJSON
@@ -97,13 +97,13 @@ class ESReindex
97
97
  create_msg = ""
98
98
  end
99
99
 
100
- options[:before_create].call if options[:before_create].present?
100
+ options[:before_create].call if options[:before_create] && options[:before_create].respond_to?(:call)
101
101
 
102
102
  log "Creating '#{durl}/#{didx}' index#{create_msg}..."
103
103
  dclient.indices.create index: didx, body: { settings: settings, mappings: mappings }
104
104
  log "Succesfully created '#{durl}/#{didx}''#{create_msg}."
105
105
 
106
- options[:after_create].call if options[:after_create].present?
106
+ options[:after_create].call if options[:after_create] && options[:after_create].respond_to?(:call)
107
107
  end
108
108
 
109
109
  true
@@ -141,13 +141,13 @@ class ESReindex
141
141
  while scroll = sclient.scroll(scroll_id: scroll['_scroll_id'], scroll: '10m') and not scroll['hits']['hits'].empty? do
142
142
  bulk = []
143
143
  scroll['hits']['hits'].each do |doc|
144
- options[:before_each].call doc if options[:before_each].present?
144
+ options[:before_each].call doc if options[:before_each] && options[:before_each].respond_to?(:call)
145
145
  ### === implement possible modifications to the document
146
146
  ### === end modifications to the document
147
147
  base = {'_index' => didx, '_id' => doc['_id'], '_type' => doc['_type'], data: doc['_source']}
148
148
  bulk << {action => base}
149
149
  @done = done + 1
150
- options[:after_each].call doc if options[:after_each].present?
150
+ options[:after_each].call doc if options[:after_each] && options[:after_each].respond_to?(:call)
151
151
  end
152
152
  unless bulk.empty?
153
153
  dclient.bulk body: bulk
@@ -159,7 +159,7 @@ class ESReindex
159
159
 
160
160
  log "Copy progress: %u/%u done in %s.\n" % [done, total, tm_len]
161
161
 
162
- options[:after_copy].call if options[:after_copy].present?
162
+ options[:after_copy].call if options[:after_copy] && options[:after_copy].respond_to?(:call)
163
163
 
164
164
  true
165
165
  end
@@ -1,3 +1,3 @@
1
1
  class ESReindex
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: es-reindex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Aiken