es-reindex 0.3.2 → 0.3.3
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.markdown +1 -0
- data/README.markdown +6 -5
- data/bin/es-reindex +5 -4
- data/lib/es-reindex.rb +2 -2
- data/lib/es-reindex/args_parser.rb +9 -2
- data/lib/es-reindex/version.rb +1 -1
- data/spec/es-reindex/args_parser_spec.rb +16 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75e91c0a58aec17def06e3d69858f98cd759f46e
|
4
|
+
data.tar.gz: d223121aa74c36553917cbd6b9cede4068383024
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ff8dd6b08a4cea265aa49d212a8ddb7a3c34472d0751932f9cec3e4b0152cb06bdb71c18e4d9ea4f71e404cab8003ef33cc2123153feb6119eb02f3bc5ae4b2
|
7
|
+
data.tar.gz: 67a9a28d9106e8c2d885eab9f4006a935a889a290aaa384701bf561ae66efc03b7d75ec744863029c8b24c04e8760659776d58fbe20b9ebee12c55c921027d35
|
data/CHANGELOG.markdown
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
## Changelog
|
2
2
|
|
3
|
+
+ __0.3.3__: Added `-nm` option [@wader](https://github.com/wader)
|
3
4
|
+ __0.3.2__: Remove activesupport dependency entirely, handle aliased indices [@waterlink](https://github.com/waterlink)
|
4
5
|
+ __0.3.1__: Add activesupport dependency since es-reindex uses methods from it.
|
5
6
|
+ __0.3.0__: Add `:if` and `:unless` callbacks
|
data/README.markdown
CHANGED
@@ -17,7 +17,7 @@ Progress and time estimation is displayed during the scrolling process.
|
|
17
17
|
|
18
18
|
Refer to script's help:
|
19
19
|
|
20
|
-
```
|
20
|
+
```
|
21
21
|
$ ./es-reindex.rb -h
|
22
22
|
|
23
23
|
Script to copy particular ES index including its (re)creation w/options set
|
@@ -25,11 +25,12 @@ and mapping copied.
|
|
25
25
|
|
26
26
|
Usage:
|
27
27
|
|
28
|
-
./es-reindex
|
28
|
+
./es-reindex [options] [source_url/]<index> [destination_url/]<index>
|
29
29
|
|
30
|
-
- -r
|
31
|
-
- -f
|
32
|
-
- -u
|
30
|
+
- -r - remove the index in the new location first
|
31
|
+
- -f - specify frame size to be obtained with one fetch during scrolling
|
32
|
+
- -u - update existing documents (default: only create non-existing)
|
33
|
+
- -nm - don't copy mappings and settings
|
33
34
|
- optional source/destination urls default to http://127.0.0.1:9200
|
34
35
|
```
|
35
36
|
|
data/bin/es-reindex
CHANGED
@@ -12,11 +12,12 @@ if ARGV.size == 0 or ARGV[0] =~ /^-(?:h|-?help)$/
|
|
12
12
|
|
13
13
|
Usage:
|
14
14
|
|
15
|
-
#{__FILE__} [
|
15
|
+
#{__FILE__} [options] [source_url/]<index> [destination_url/]<index>
|
16
16
|
|
17
|
-
- -r
|
18
|
-
- -f
|
19
|
-
- -u
|
17
|
+
- -r - remove the index in the new location first
|
18
|
+
- -f - specify frame size to be obtained with one fetch during scrolling
|
19
|
+
- -u - update existing documents (default: only create non-existing)
|
20
|
+
- -nm - dont't copy mappings and settings
|
20
21
|
- optional source/destination urls default to http://127.0.0.1:9200
|
21
22
|
\n"
|
22
23
|
|
data/lib/es-reindex.rb
CHANGED
@@ -108,8 +108,8 @@ class ESReindex
|
|
108
108
|
return false unless get_mappings
|
109
109
|
create_msg = " with settings & mappings from '#{surl}/#{sidx}'"
|
110
110
|
else
|
111
|
-
@mappings = options[:mappings].call
|
112
|
-
@settings = options[:settings].call
|
111
|
+
@mappings = options[:mappings].nil? ? {} : options[:mappings].call
|
112
|
+
@settings = options[:settings].nil? ? {} : options[:settings].call
|
113
113
|
create_msg = ""
|
114
114
|
end
|
115
115
|
|
@@ -2,13 +2,19 @@ class ESReindex
|
|
2
2
|
class ArgsParser
|
3
3
|
|
4
4
|
def self.parse(args)
|
5
|
-
remove
|
5
|
+
remove = false
|
6
|
+
update = false
|
7
|
+
frame = 1000
|
8
|
+
src = nil
|
9
|
+
dst = nil
|
10
|
+
copy_mappings = true
|
6
11
|
|
7
12
|
while args[0]
|
8
13
|
case arg = args.shift
|
9
14
|
when '-r' then remove = true
|
10
15
|
when '-f' then frame = args.shift.to_i
|
11
16
|
when '-u' then update = true
|
17
|
+
when '-nm' then copy_mappings = false
|
12
18
|
else
|
13
19
|
u = arg.chomp '/'
|
14
20
|
!src ? (src = u) : !dst ? (dst = u) :
|
@@ -19,7 +25,8 @@ class ESReindex
|
|
19
25
|
return src, dst, {
|
20
26
|
remove: remove,
|
21
27
|
frame: frame,
|
22
|
-
update: update
|
28
|
+
update: update,
|
29
|
+
copy_mappings: copy_mappings,
|
23
30
|
}
|
24
31
|
end
|
25
32
|
end
|
data/lib/es-reindex/version.rb
CHANGED
@@ -74,4 +74,20 @@ describe ESReindex::ArgsParser do
|
|
74
74
|
expect(parsed_opts[:update]).to be true
|
75
75
|
end
|
76
76
|
end
|
77
|
+
|
78
|
+
context "without -nm" do
|
79
|
+
let(:args) { ["-u"] }
|
80
|
+
|
81
|
+
it "sets copy_mappings to true" do
|
82
|
+
expect(parsed_opts[:copy_mappings]).to be true
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context "with -nm" do
|
87
|
+
let(:args) { ["-u", "-nm"] }
|
88
|
+
|
89
|
+
it "sets copy_mappings to false" do
|
90
|
+
expect(parsed_opts[:copy_mappings]).to be false
|
91
|
+
end
|
92
|
+
end
|
77
93
|
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.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Aiken
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: elasticsearch
|
@@ -170,3 +170,4 @@ test_files:
|
|
170
170
|
- spec/integration/reindex_spec.rb
|
171
171
|
- spec/spec_helper.rb
|
172
172
|
- spec/support/test_model.rb
|
173
|
+
has_rdoc:
|