es_dump_restore 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/es_dump_restore/app.rb +13 -10
- data/lib/es_dump_restore/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fd3daa61667baf72f9f0c62fe8b6f71e0e5c5de
|
4
|
+
data.tar.gz: a9d1eb03b685529be48895e92a856443e8cec280
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a5728d62cfd999870e6d19b3ba4ad8350dce18d8ec860616c39d475cd01d39f27bf85fa429e4da75f6c2fb5d7c6d339c6a89289cc0a808f2aeaf67bc4d6e5d3
|
7
|
+
data.tar.gz: 6076595aba9cb8c3beec6259fd70fef81917ea8841115c7fb1c76e2e858c531b25f06d92fb0d785cf582c89095629e0387adaae34a63c6e5ef3591bd26b82c28
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# Version 2.0.0 - July 1, 2015
|
2
|
+
|
3
|
+
Thanks to Alex Tomlins for this feature contribution
|
4
|
+
|
5
|
+
* Make progress bar options globally available
|
6
|
+
* VERY MINOR BREAKING CHANGE: Invert the `--noprogressbar` option, which is now `--progressbar` or `--no-progress-bar`
|
7
|
+
|
1
8
|
# Version 1.2.0 - June 24, 2015
|
2
9
|
|
3
10
|
* Allow overriding the batch size on the command line (thanks to Richard Boulton once again!)
|
data/lib/es_dump_restore/app.rb
CHANGED
@@ -6,8 +6,11 @@ require "multi_json"
|
|
6
6
|
|
7
7
|
module EsDumpRestore
|
8
8
|
class App < Thor
|
9
|
-
|
10
|
-
|
9
|
+
class_option :progressbar,
|
10
|
+
type: :boolean,
|
11
|
+
default: $stderr.isatty,
|
12
|
+
desc: "Whether to show the progress bar. Defaults to true if STDERR is a TTY, false otherwise."
|
13
|
+
|
11
14
|
option :verbose, :type => :boolean # add some additional output
|
12
15
|
|
13
16
|
desc "dump URL INDEX_NAME FILENAME", "Creates a dumpfile based on the given ElasticSearch index"
|
@@ -22,13 +25,13 @@ module EsDumpRestore
|
|
22
25
|
|
23
26
|
client.start_scan do |scroll_id, total|
|
24
27
|
dumpfile.num_objects = total
|
25
|
-
bar = ProgressBar.new(total)
|
28
|
+
bar = ProgressBar.new(total) if options[:progressbar]
|
26
29
|
|
27
30
|
dumpfile.get_objects_output_stream do |out|
|
28
31
|
client.each_scroll_hit(scroll_id) do |hit|
|
29
32
|
metadata = { index: { _type: hit["_type"], _id: hit["_id"] } }
|
30
33
|
out.write("#{MultiJson.dump(metadata)}\n#{MultiJson.dump(hit["_source"])}\n")
|
31
|
-
bar.increment!
|
34
|
+
bar.increment! if options[:progressbar]
|
32
35
|
end
|
33
36
|
end
|
34
37
|
end
|
@@ -47,13 +50,13 @@ module EsDumpRestore
|
|
47
50
|
|
48
51
|
client.start_scan do |scroll_id, total|
|
49
52
|
dumpfile.num_objects = total
|
50
|
-
bar = ProgressBar.new(total)
|
53
|
+
bar = ProgressBar.new(total) if options[:progressbar]
|
51
54
|
|
52
55
|
dumpfile.get_objects_output_stream do |out|
|
53
56
|
client.each_scroll_hit(scroll_id) do |hit|
|
54
57
|
metadata = { index: { _type: hit["_type"], _id: hit["_id"] } }
|
55
58
|
out.write("#{MultiJson.dump(metadata)}\n#{MultiJson.dump(hit["_source"])}\n")
|
56
|
-
bar.increment!
|
59
|
+
bar.increment! if options[:progressbar]
|
57
60
|
end
|
58
61
|
end
|
59
62
|
end
|
@@ -67,10 +70,10 @@ module EsDumpRestore
|
|
67
70
|
Dumpfile.read(filename) do |dumpfile|
|
68
71
|
client.create_index(dumpfile.index, overrides)
|
69
72
|
|
70
|
-
bar = ProgressBar.new(dumpfile.num_objects)
|
73
|
+
bar = ProgressBar.new(dumpfile.num_objects) if options[:progressbar]
|
71
74
|
dumpfile.scan_objects(batch_size.to_i) do |batch, size|
|
72
75
|
client.bulk_index batch
|
73
|
-
bar.increment!(size)
|
76
|
+
bar.increment!(size) if options[:progressbar]
|
74
77
|
end
|
75
78
|
end
|
76
79
|
end
|
@@ -84,10 +87,10 @@ module EsDumpRestore
|
|
84
87
|
Dumpfile.read(filename) do |dumpfile|
|
85
88
|
client.create_index(dumpfile.index, overrides)
|
86
89
|
|
87
|
-
bar = ProgressBar.new(dumpfile.num_objects)
|
90
|
+
bar = ProgressBar.new(dumpfile.num_objects) if options[:progressbar]
|
88
91
|
dumpfile.scan_objects(batch_size.to_i) do |batch, size|
|
89
92
|
client.bulk_index batch
|
90
|
-
bar.increment!(size)
|
93
|
+
bar.increment!(size) if options[:progressbar]
|
91
94
|
end
|
92
95
|
end
|
93
96
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: es_dump_restore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nat Budin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|