es-reindex 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/Guardfile +5 -0
- data/LICENSE +21 -0
- data/README.markdown +73 -0
- data/bin/es-reindex +27 -0
- data/es-reindex.gemspec +33 -0
- data/lib/es-reindex.rb +190 -0
- data/lib/es-reindex/args_parser.rb +26 -0
- data/lib/es-reindex/version.rb +3 -0
- data/spec/es-reindex/args_parser_spec.rb +77 -0
- data/spec/es-reindex_spec.rb +19 -0
- data/spec/spec_helper.rb +13 -0
- metadata +160 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7620b0c56bc7c9531fd32c9c573bfef963a3a2eb
|
4
|
+
data.tar.gz: 86eb8a9c6f896e6697d3adb3de6af34dc99fd866
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 853868790c7f1b8658995ec38b4d9b5fc87bdf5658b6fa9dcca32d5a64cb6c14e1af9b294e1256e36c18f38bf828e6a0daeadf5d48efb607e110020e7020d772
|
7
|
+
data.tar.gz: fd4f29b8dadb1cacf345161e2928f541ee4a366ad98349d24de49fac848bdb13dd602f3fbcb9698d52bb90d17a94bb2cee30d8c8779a1e6c00a1f068c0a2b91f
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2012 Jiri Nemecek
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
data/README.markdown
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# es-reindex - simple ruby gem for copying ElasticSearch index
|
2
|
+
|
3
|
+
Simple ruby gem to copy and reindex ElasticSearch index,
|
4
|
+
copying index settings and mapping(s).
|
5
|
+
|
6
|
+
Progress and time estimation is displayed during the scrolling process.
|
7
|
+
|
8
|
+
## Requirements
|
9
|
+
|
10
|
+
Ruby 1.9.3 or newer is required, use [rvm](https://rvm.io/) for convenience.
|
11
|
+
|
12
|
+
Following gems are required:
|
13
|
+
|
14
|
+
+ [rest-client](https://github.com/archiloque/rest-client)
|
15
|
+
+ [multi_json](https://github.com/intridea/multi_json)
|
16
|
+
|
17
|
+
## Usage (command line)
|
18
|
+
|
19
|
+
Refer to script's help:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
$ ./es-reindex.rb -h
|
23
|
+
|
24
|
+
Script to copy particular ES index including its (re)creation w/options set
|
25
|
+
and mapping copied.
|
26
|
+
|
27
|
+
Usage:
|
28
|
+
|
29
|
+
./es-reindex.rb [-r] [-f <frame>] [source_url/]<index> [destination_url/]<index>
|
30
|
+
|
31
|
+
- -r - remove the index in the new location first
|
32
|
+
- -f - specify frame size to be obtained with one fetch during scrolling
|
33
|
+
- -u - update existing documents (default: only create non-existing)
|
34
|
+
- optional source/destination urls default to http://127.0.0.1:9200
|
35
|
+
```
|
36
|
+
|
37
|
+
## Usage (in project)
|
38
|
+
|
39
|
+
You can also use it as a PORO:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
# Options:
|
43
|
+
# remove: same as -r
|
44
|
+
# frame: same as -f
|
45
|
+
# update: same as -u cli option
|
46
|
+
|
47
|
+
options = {
|
48
|
+
remove: true,
|
49
|
+
update: true
|
50
|
+
}
|
51
|
+
|
52
|
+
ESReindex.new('http://my_server/index', 'http://my_server/index_copy', options).go!
|
53
|
+
```
|
54
|
+
|
55
|
+
## Changelog
|
56
|
+
|
57
|
+
+ __0.1.0__: First gem release
|
58
|
+
+ __0.0.9__: Gemification, Oj -> MultiJSON
|
59
|
+
+ __0.0.8__: Optimization in string concat (@nara)
|
60
|
+
+ __0.0.7__: Document header arguments `_timestamp` and `_ttl` are copied as well
|
61
|
+
+ __0.0.6__: Document headers in bulks are now assembled and properly JSON dumped
|
62
|
+
+ __0.0.5__: Merge fix for trailing slash in urls (@ichinco), formatting cleanup
|
63
|
+
+ __0.0.4__: Force create only, update is optional (@pgaertig)
|
64
|
+
+ __0.0.3__: Yajl -> Oj
|
65
|
+
+ __0.0.2__: repated document count comparison
|
66
|
+
+ __0.0.1__: first revision
|
67
|
+
|
68
|
+
## License
|
69
|
+
es-reindex the gem is copyright (c)2014 Mojo Lingo, and released under the terms
|
70
|
+
of the MIT license. See the LICENSE file for the gory details.
|
71
|
+
|
72
|
+
es-reindex is copyright (c)2012 Jiri Nemecek, and released under the terms
|
73
|
+
of the MIT license. See the LICENSE file for the gory details.
|
data/bin/es-reindex
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'es-reindex'
|
4
|
+
require 'es-reindex/args_parser'
|
5
|
+
|
6
|
+
STDOUT.sync = true
|
7
|
+
|
8
|
+
if ARGV.size == 0 or ARGV[0] =~ /^-(?:h|-?help)$/
|
9
|
+
puts "
|
10
|
+
Script to copy particular ES index including its (re)creation w/options set
|
11
|
+
and mapping copied.
|
12
|
+
|
13
|
+
Usage:
|
14
|
+
|
15
|
+
#{__FILE__} [-r] [-f <frame>] [source_url/]<index> [destination_url/]<index>
|
16
|
+
|
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
|
+
- optional source/destination urls default to http://127.0.0.1:9200
|
21
|
+
\n"
|
22
|
+
|
23
|
+
exit 1
|
24
|
+
end
|
25
|
+
|
26
|
+
src, dst, options = ESReindex::ArgsParser.parse(ARGV)
|
27
|
+
ESReindex.new(src, dst, options).go!
|
data/es-reindex.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
$:.push File.expand_path("../lib", __FILE__)
|
4
|
+
require "es-reindex/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "es-reindex"
|
8
|
+
s.version = ESReindex::VERSION
|
9
|
+
s.authors = ["Justin Aiken"]
|
10
|
+
s.email = ["jaiken@mojolingo.com"]
|
11
|
+
s.homepage = "https://github.com/mojolingo/es-reindex"
|
12
|
+
s.summary = %q{Ruby gem to copy ElasticSearch index (reindex).}
|
13
|
+
s.description = %q{Ruby gem to copy ElasticSearch index (reindex).}
|
14
|
+
s.license = 'MIT'
|
15
|
+
|
16
|
+
s.rubyforge_project = "es-reindex"
|
17
|
+
|
18
|
+
s.required_ruby_version = '>= 1.9.3'
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
s.require_paths = ["lib"]
|
24
|
+
|
25
|
+
s.add_runtime_dependency 'rest-client', '>= 1.6.0'
|
26
|
+
s.add_runtime_dependency 'multi_json'
|
27
|
+
|
28
|
+
s.add_development_dependency %q<coveralls>, ['>= 0']
|
29
|
+
s.add_development_dependency %q<bundler>, ["~> 1.0"]
|
30
|
+
s.add_development_dependency %q<rspec>, ["~> 2.99"]
|
31
|
+
s.add_development_dependency %q<rake>, [">= 0"]
|
32
|
+
s.add_development_dependency %q<guard-rspec>, ['~> 4.5']
|
33
|
+
end
|
data/lib/es-reindex.rb
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
class ESReindex
|
5
|
+
|
6
|
+
DEFAULT_URL = 'http://10.203.175.32:9200'
|
7
|
+
|
8
|
+
attr_accessor :src, :dst, :options, :start_time, :done
|
9
|
+
|
10
|
+
def initialize(src, dst, options = {})
|
11
|
+
@src = src || ''
|
12
|
+
@dst = dst || ''
|
13
|
+
@options = {
|
14
|
+
remove: false, # remove the index in the new location first
|
15
|
+
update: false, # update existing documents (default: only create non-existing)
|
16
|
+
frame: 1000 # specify frame size to be obtained with one fetch during scrolling
|
17
|
+
}.merge! options
|
18
|
+
|
19
|
+
@done = 0
|
20
|
+
end
|
21
|
+
|
22
|
+
def go!
|
23
|
+
MultiJson.load_options = {mode: :compat}
|
24
|
+
MultiJson.dump_options = {mode: :compat}
|
25
|
+
|
26
|
+
surl, durl, sidx, didx = '', '', '', ''
|
27
|
+
[[src, surl, sidx], [dst, durl, didx]].each do |param, url, idx|
|
28
|
+
if param =~ %r{^(.*)/(.*?)$}
|
29
|
+
url.replace $1
|
30
|
+
idx.replace $2
|
31
|
+
else
|
32
|
+
url.replace DEFAULT_URL
|
33
|
+
idx.replace param
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
printf "Copying '%s/%s' to '%s/%s'%s\n Confirm or hit Ctrl-c to abort...\n",
|
38
|
+
surl, sidx, durl, didx,
|
39
|
+
remove? ?
|
40
|
+
' with rewriting destination mapping!' :
|
41
|
+
update? ? ' with updating existing documents!' : '.'
|
42
|
+
|
43
|
+
$stdin.readline
|
44
|
+
|
45
|
+
# remove old index in case of remove=true
|
46
|
+
retried_request(:delete, "#{durl}/#{didx}") if remove? && retried_request(:get, "#{durl}/#{didx}/_status")
|
47
|
+
|
48
|
+
# (re)create destination index
|
49
|
+
unless retried_request :get, "#{durl}/#{didx}/_status"
|
50
|
+
# obtain the original index settings first
|
51
|
+
unless settings = retried_request(:get, "#{surl}/#{sidx}/_settings")
|
52
|
+
warn "Failed to obtain original index '#{surl}/#{sidx}' settings!"
|
53
|
+
exit 1
|
54
|
+
end
|
55
|
+
settings = MultiJson.load settings
|
56
|
+
sidx = settings.keys[0]
|
57
|
+
settings[sidx].delete 'index.version.created'
|
58
|
+
printf 'Creating \'%s/%s\' index with settings from \'%s/%s\'... ', durl, didx, surl, sidx
|
59
|
+
unless retried_request :post, "#{durl}/#{didx}", MultiJson.dump(settings[sidx])
|
60
|
+
puts 'FAILED!'
|
61
|
+
exit 1
|
62
|
+
else
|
63
|
+
puts 'OK.'
|
64
|
+
end
|
65
|
+
unless mappings = retried_request(:get, "#{surl}/#{sidx}/_mapping")
|
66
|
+
warn "Failed to obtain original index '#{surl}/#{sidx}' mappings!"
|
67
|
+
exit 1
|
68
|
+
end
|
69
|
+
mappings = MultiJson.load mappings
|
70
|
+
mappings = mappings[sidx]
|
71
|
+
mappings = mappings['mappings'] if mappings.is_a?(Hash) && mappings.has_key?('mappings')
|
72
|
+
mappings.each_pair do |type, mapping|
|
73
|
+
printf 'Copying mapping \'%s/%s/%s\'... ', durl, didx, type
|
74
|
+
unless retried_request(:put, "#{durl}/#{didx}/#{type}/_mapping", MultiJson.dump(type => mapping))
|
75
|
+
puts 'FAILED!'
|
76
|
+
exit 1
|
77
|
+
else
|
78
|
+
puts 'OK.'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
printf "Copying '%s/%s' to '%s/%s'... \n", surl, sidx, durl, didx
|
84
|
+
@start_time = Time.now
|
85
|
+
shards = retried_request :get, "#{surl}/#{sidx}/_count?q=*"
|
86
|
+
shards = MultiJson.load(shards)['_shards']['total'].to_i
|
87
|
+
scan = retried_request :get, "#{surl}/#{sidx}/_search?search_type=scan&scroll=10m&size=#{frame / shards}"
|
88
|
+
scan = MultiJson.load scan
|
89
|
+
scroll_id = scan['_scroll_id']
|
90
|
+
total = scan['hits']['total']
|
91
|
+
printf " %u/%u (%.1f%%) done.\r", done, total, 0
|
92
|
+
|
93
|
+
bulk_op = update? ? 'index' : 'create'
|
94
|
+
|
95
|
+
while true do
|
96
|
+
data = retried_request :get, "#{surl}/_search/scroll?scroll=10m&scroll_id=#{scroll_id}"
|
97
|
+
data = MultiJson.load data
|
98
|
+
break if data['hits']['hits'].empty?
|
99
|
+
scroll_id = data['_scroll_id']
|
100
|
+
bulk = ''
|
101
|
+
data['hits']['hits'].each do |doc|
|
102
|
+
### === implement possible modifications to the document
|
103
|
+
### === end modifications to the document
|
104
|
+
base = {'_index' => didx, '_id' => doc['_id'], '_type' => doc['_type']}
|
105
|
+
['_timestamp', '_ttl'].each{|doc_arg|
|
106
|
+
base[doc_arg] = doc[doc_arg] if doc.key? doc_arg
|
107
|
+
}
|
108
|
+
bulk << MultiJson.dump(bulk_op => base) + "\n"
|
109
|
+
bulk << MultiJson.dump(doc['_source']) + "\n"
|
110
|
+
@done = done + 1
|
111
|
+
end
|
112
|
+
unless bulk.empty?
|
113
|
+
bulk << "\n" # empty line in the end required
|
114
|
+
retried_request :post, "#{durl}/_bulk", bulk
|
115
|
+
end
|
116
|
+
|
117
|
+
eta = total * (Time.now - start_time) / done
|
118
|
+
printf " %u/%u (%.1f%%) done in %s, E.T.A.: %s.\r",
|
119
|
+
done, total, 100.0 * done / total, tm_len, start_time + eta
|
120
|
+
end
|
121
|
+
|
122
|
+
printf "#{' ' * 80}\r %u/%u done in %s.\n", done, total, tm_len
|
123
|
+
|
124
|
+
# no point for large reindexation with data still being stored in index
|
125
|
+
printf 'Checking document count... '
|
126
|
+
scount, dcount = 1, 0
|
127
|
+
begin
|
128
|
+
Timeout::timeout(60) do
|
129
|
+
while true
|
130
|
+
scount = retried_request :get, "#{surl}/#{sidx}/_count?q=*"
|
131
|
+
dcount = retried_request :get, "#{durl}/#{didx}/_count?q=*"
|
132
|
+
scount = MultiJson.load(scount)['count'].to_i
|
133
|
+
dcount = MultiJson.load(dcount)['count'].to_i
|
134
|
+
break if scount == dcount
|
135
|
+
sleep 1
|
136
|
+
end
|
137
|
+
end
|
138
|
+
rescue Timeout::Error
|
139
|
+
end
|
140
|
+
printf "%u == %u (%s\n", scount, dcount, scount == dcount ? 'equals).' : 'NOT EQUAL)!'
|
141
|
+
|
142
|
+
exit 0
|
143
|
+
end
|
144
|
+
|
145
|
+
private
|
146
|
+
|
147
|
+
def remove?
|
148
|
+
@options[:remove]
|
149
|
+
end
|
150
|
+
|
151
|
+
def update?
|
152
|
+
@options[:update]
|
153
|
+
end
|
154
|
+
|
155
|
+
def frame
|
156
|
+
@options[:frame]
|
157
|
+
end
|
158
|
+
|
159
|
+
def tm_len
|
160
|
+
l = Time.now - @start_time
|
161
|
+
t = []
|
162
|
+
t.push l/86400; l %= 86400
|
163
|
+
t.push l/3600; l %= 3600
|
164
|
+
t.push l/60; l %= 60
|
165
|
+
t.push l
|
166
|
+
out = sprintf '%u', t.shift
|
167
|
+
out = out == '0' ? '' : out + ' days, '
|
168
|
+
out << sprintf('%u:%02u:%02u', *t)
|
169
|
+
out
|
170
|
+
end
|
171
|
+
|
172
|
+
def retried_request(method, url, data=nil)
|
173
|
+
while true
|
174
|
+
begin
|
175
|
+
return data ?
|
176
|
+
RestClient.send(method, url, data) :
|
177
|
+
RestClient.send(method, url)
|
178
|
+
rescue RestClient::ResourceNotFound # no point to retry
|
179
|
+
return nil
|
180
|
+
rescue RestClient::BadRequest => e # Something's wrong!
|
181
|
+
warn "\n#{method.to_s.upcase} #{url} :-> ERROR: #{e.class} - #{e.message}"
|
182
|
+
warn e.response
|
183
|
+
return nil
|
184
|
+
rescue => e
|
185
|
+
warn "\nRetrying #{method.to_s.upcase} ERROR: #{e.class} - #{e.message}"
|
186
|
+
warn e.response
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class ESReindex
|
2
|
+
class ArgsParser
|
3
|
+
|
4
|
+
def self.parse(args)
|
5
|
+
remove, update, frame, src, dst = false, false, 1000, nil, nil
|
6
|
+
|
7
|
+
while args[0]
|
8
|
+
case arg = args.shift
|
9
|
+
when '-r' then remove = true
|
10
|
+
when '-f' then frame = args.shift.to_i
|
11
|
+
when '-u' then update = true
|
12
|
+
else
|
13
|
+
u = arg.chomp '/'
|
14
|
+
!src ? (src = u) : !dst ? (dst = u) :
|
15
|
+
raise("Unexpected parameter '#{arg}'. Use '-h' for help.")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
return src, dst, {
|
20
|
+
remove: remove,
|
21
|
+
frame: frame,
|
22
|
+
update: update
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ESReindex::ArgsParser do
|
4
|
+
|
5
|
+
let(:parsed_args) { described_class.parse args }
|
6
|
+
let(:parsed_src) { parsed_args[0] }
|
7
|
+
let(:parsed_dst) { parsed_args[1] }
|
8
|
+
let(:parsed_opts) { parsed_args[2] }
|
9
|
+
|
10
|
+
context "with no src or dst" do
|
11
|
+
let(:args) { ["-r", "-u"] }
|
12
|
+
|
13
|
+
it "src is nil" do
|
14
|
+
expect(parsed_src).to be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it "dst is nil" do
|
18
|
+
expect(parsed_dst).to be_nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "with a src" do
|
23
|
+
let(:args) { ["-r", "-u", "http://foo/index"] }
|
24
|
+
|
25
|
+
it "src is set" do
|
26
|
+
expect(parsed_src).to eq 'http://foo/index'
|
27
|
+
end
|
28
|
+
|
29
|
+
it "dst is nil" do
|
30
|
+
expect(parsed_dst).to be_nil
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "with a src and dst" do
|
35
|
+
let(:args) { ["-r", "-u", "http://foo/index", "bar/index"] }
|
36
|
+
|
37
|
+
it "src is set" do
|
38
|
+
expect(parsed_src).to eq 'http://foo/index'
|
39
|
+
end
|
40
|
+
|
41
|
+
it "dst is set" do
|
42
|
+
expect(parsed_dst).to eq 'bar/index'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "without -f" do
|
47
|
+
let(:args) { ["-u"] }
|
48
|
+
|
49
|
+
it "sets the frame to the default (1000)" do
|
50
|
+
expect(parsed_opts[:frame]).to eq 1000
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context "with -f" do
|
55
|
+
let(:args) { ["-f", "1500"] }
|
56
|
+
|
57
|
+
it "sets the frame" do
|
58
|
+
expect(parsed_opts[:frame]).to eq 1500
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context "without -u" do
|
63
|
+
let(:args) { ["-f", '1000', 'foosrc/index'] }
|
64
|
+
|
65
|
+
it "sets update to false" do
|
66
|
+
expect(parsed_opts[:update]).to be false
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context "with -u" do
|
71
|
+
let(:args) { ["-u"] }
|
72
|
+
|
73
|
+
it "sets the frame" do
|
74
|
+
expect(parsed_opts[:update]).to be true
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ESReindex do
|
4
|
+
let(:src) { 'http://foo/bar_index' }
|
5
|
+
let(:dst) { 'http://biz/baz_index' }
|
6
|
+
let(:options) { {update: true} }
|
7
|
+
|
8
|
+
let(:reindexer) { ESReindex.new src, dst, options }
|
9
|
+
|
10
|
+
it "can be freshly initialized with options" do
|
11
|
+
expect(reindexer.options).to eq remove: false, update: true, frame: 1000
|
12
|
+
end
|
13
|
+
|
14
|
+
it "starts with 0 indexes done" do
|
15
|
+
expect(reindexer.done).to eq 0
|
16
|
+
end
|
17
|
+
|
18
|
+
skip "it can actually do stuff"
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: es-reindex
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justin Aiken
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.6.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.6.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: multi_json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: coveralls
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.99'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.99'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '4.5'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '4.5'
|
111
|
+
description: Ruby gem to copy ElasticSearch index (reindex).
|
112
|
+
email:
|
113
|
+
- jaiken@mojolingo.com
|
114
|
+
executables:
|
115
|
+
- es-reindex
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rspec"
|
121
|
+
- Gemfile
|
122
|
+
- Guardfile
|
123
|
+
- LICENSE
|
124
|
+
- README.markdown
|
125
|
+
- bin/es-reindex
|
126
|
+
- es-reindex.gemspec
|
127
|
+
- lib/es-reindex.rb
|
128
|
+
- lib/es-reindex/args_parser.rb
|
129
|
+
- lib/es-reindex/version.rb
|
130
|
+
- spec/es-reindex/args_parser_spec.rb
|
131
|
+
- spec/es-reindex_spec.rb
|
132
|
+
- spec/spec_helper.rb
|
133
|
+
homepage: https://github.com/mojolingo/es-reindex
|
134
|
+
licenses:
|
135
|
+
- MIT
|
136
|
+
metadata: {}
|
137
|
+
post_install_message:
|
138
|
+
rdoc_options: []
|
139
|
+
require_paths:
|
140
|
+
- lib
|
141
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 1.9.3
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
requirements: []
|
152
|
+
rubyforge_project: es-reindex
|
153
|
+
rubygems_version: 2.4.5
|
154
|
+
signing_key:
|
155
|
+
specification_version: 4
|
156
|
+
summary: Ruby gem to copy ElasticSearch index (reindex).
|
157
|
+
test_files:
|
158
|
+
- spec/es-reindex/args_parser_spec.rb
|
159
|
+
- spec/es-reindex_spec.rb
|
160
|
+
- spec/spec_helper.rb
|