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 +4 -4
- data/README.markdown +1 -0
- data/lib/es-reindex.rb +5 -5
- data/lib/es-reindex/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bfec9b90b4f6f60bca9fbc2e31b512e91859ee0
|
4
|
+
data.tar.gz: 34d5f1814a05ad2cb3eeee1427bb8fb1126006a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa461c5f68ded8c5e1fb03436cc414df23d7c7dd21e8896c29675c21f6d1a5b5114db2a19de2027d0bbd6ccb773441fb9b59781bf1b769b9d60a597e17828ead
|
7
|
+
data.tar.gz: 0a7288a5c3a040c061f99bdb32f3153789cf76d13827535f3a2a5f866469d65527e4f85d2df1f184c40506fe01ad8afd47bca3f60c3f05cf23332e4963f84b38
|
data/README.markdown
CHANGED
@@ -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
|
data/lib/es-reindex.rb
CHANGED
@@ -97,13 +97,13 @@ class ESReindex
|
|
97
97
|
create_msg = ""
|
98
98
|
end
|
99
99
|
|
100
|
-
options[:before_create].call if options[:before_create].
|
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].
|
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].
|
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].
|
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].
|
162
|
+
options[:after_copy].call if options[:after_copy] && options[:after_copy].respond_to?(:call)
|
163
163
|
|
164
164
|
true
|
165
165
|
end
|
data/lib/es-reindex/version.rb
CHANGED