es_dump_restore 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +7 -2
- data/lib/es_dump_restore/app.rb +5 -4
- 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: a45b3f41110e68aa160d81d3094501b4db2d914a
|
4
|
+
data.tar.gz: 127abfad968e31cfd7fb1ea1d933dd55d9497839
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a888f720b201ec78d4a6b1c2ca75033f2fd98e07838282a3180fe3a3488d8d39faa4971073f4e5b027049e0f01ec038ef0a274cf710a89f07856241e4c564e4
|
7
|
+
data.tar.gz: ca426d7becd4d7f59d2708d926a38aae42a56a23a4bd9b2b7657f65c5f860897e4da5578175cbe971b04fd48d3898b5de19ff7d2a1fe3c40ff5e8fcc5f2d88cb
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# Version 1.2.0 - June 24, 2015
|
2
|
+
|
3
|
+
* Allow overriding the batch size on the command line (thanks to Richard Boulton once again!)
|
4
|
+
|
1
5
|
# Version 1.1.0 - May 12, 2015
|
2
6
|
|
3
7
|
* Allow specifying additional index settings to the `restore` and `restore_alias` commands (thanks again Richard Boulton!)
|
data/README.md
CHANGED
@@ -23,11 +23,11 @@ To dump an ElasticSearch index by type to a file:
|
|
23
23
|
|
24
24
|
To restore an index to an ElasticSearch server:
|
25
25
|
|
26
|
-
es_dump_restore restore ELASTIC_SEARCH_SERVER_URL DESTINATION_INDEX FILENAME_ZIP [SETTING_OVERRIDES]
|
26
|
+
es_dump_restore restore ELASTIC_SEARCH_SERVER_URL DESTINATION_INDEX FILENAME_ZIP [SETTING_OVERRIDES] [BATCH_SIZE]
|
27
27
|
|
28
28
|
To restore an index and set an alias to point to it:
|
29
29
|
|
30
|
-
es_dump_restore restore_alias ELASTIC_SEARCH_SERVER_URL DESTINATION_ALIAS DESTINATION_INDEX FILENAME_ZIP [SETTING_OVERRIDES]
|
30
|
+
es_dump_restore restore_alias ELASTIC_SEARCH_SERVER_URL DESTINATION_ALIAS DESTINATION_INDEX FILENAME_ZIP [SETTING_OVERRIDES] [BATCH_SIZE]
|
31
31
|
|
32
32
|
This loads the dump into an index named `DESTINATION_INDEX`, and once the load
|
33
33
|
is complete sets the alias `DESTINATION_ALIAS` to point to it. If
|
@@ -48,6 +48,11 @@ would read the dump file `test_dump.zip`, load it into an index called
|
|
48
48
|
would be set to have no replicas, and only 1 shard, but have all other settings
|
49
49
|
from the dump file.
|
50
50
|
|
51
|
+
If `BATCH_SIZE` is set for a restore command, it controls the number of
|
52
|
+
documents which will be sent to elasticsearch at once. This defaults to 1000,
|
53
|
+
which is normally fine, but if you have particularly complex documents or
|
54
|
+
mappings this might need reducing to avoid timeouts.
|
55
|
+
|
51
56
|
## Contributing
|
52
57
|
|
53
58
|
1. Fork it
|
data/lib/es_dump_restore/app.rb
CHANGED
@@ -61,14 +61,14 @@ module EsDumpRestore
|
|
61
61
|
end
|
62
62
|
|
63
63
|
desc "restore URL INDEX_NAME FILENAME", "Restores a dumpfile into the given ElasticSearch index"
|
64
|
-
def restore(url, index_name, filename, overrides=nil)
|
64
|
+
def restore(url, index_name, filename, overrides = nil, batch_size = 1000)
|
65
65
|
client = EsClient.new(url, index_name, nil)
|
66
66
|
|
67
67
|
Dumpfile.read(filename) do |dumpfile|
|
68
68
|
client.create_index(dumpfile.index, overrides)
|
69
69
|
|
70
70
|
bar = ProgressBar.new(dumpfile.num_objects) unless options[:noprogressbar]
|
71
|
-
dumpfile.scan_objects(
|
71
|
+
dumpfile.scan_objects(batch_size.to_i) do |batch, size|
|
72
72
|
client.bulk_index batch
|
73
73
|
bar.increment!(size) unless options[:noprogressbar]
|
74
74
|
end
|
@@ -76,7 +76,8 @@ module EsDumpRestore
|
|
76
76
|
end
|
77
77
|
|
78
78
|
desc "restore_alias URL ALIAS_NAME INDEX_NAME FILENAME", "Restores a dumpfile into the given ElasticSearch index, and then sets the alias to point at that index, removing any existing indexes pointed at by the alias"
|
79
|
-
def restore_alias(url, alias_name, index_name, filename, overrides=nil
|
79
|
+
def restore_alias(url, alias_name, index_name, filename, overrides = nil,
|
80
|
+
batch_size = 1000)
|
80
81
|
client = EsClient.new(url, index_name, nil)
|
81
82
|
client.check_alias alias_name
|
82
83
|
|
@@ -84,7 +85,7 @@ module EsDumpRestore
|
|
84
85
|
client.create_index(dumpfile.index, overrides)
|
85
86
|
|
86
87
|
bar = ProgressBar.new(dumpfile.num_objects) unless options[:noprogressbar]
|
87
|
-
dumpfile.scan_objects(
|
88
|
+
dumpfile.scan_objects(batch_size.to_i) do |batch, size|
|
88
89
|
client.bulk_index batch
|
89
90
|
bar.increment!(size) unless options[:noprogressbar]
|
90
91
|
end
|
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: 1.
|
4
|
+
version: 1.2.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-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|