embulk-output-elasticsearch_ruby 0.1.2 → 0.1.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa58203826c27f09b0718aef621215454a566ba8
|
4
|
+
data.tar.gz: 56df8f9037ab43256371ac5ce6676fd2b4090b51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d8b36ea7a732fb07726c5c0ab97c29f74f6c4d0becfe05944004ee4dd504da0d783ec3e6d3435c959f9e2a2490b23cc2ecda4802fd98082080c0fbd0f211059
|
7
|
+
data.tar.gz: 88726e478cd79064319e478457b7144d8b762e867d5bc206d6fdc000bec394d8fb3624ac6018c52c6c2a84285b600c4ee016576a706b79eb81ec250258b377a6
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
spec.name = "embulk-output-elasticsearch_ruby"
|
4
|
-
spec.version = "0.1.
|
4
|
+
spec.version = "0.1.3"
|
5
5
|
spec.authors = ["toyama0919"]
|
6
6
|
spec.summary = "Elasticsearch Ruby output plugin for Embulk. Elasticsearch 1.X AND 2.X AND 5.X compatible."
|
7
7
|
spec.description = "Dumps records to Elasticsearch Ruby. Elasticsearch 1.X AND 2.X AND 5.X compatible."
|
@@ -25,10 +25,17 @@ module Embulk
|
|
25
25
|
"retry_on_failure" => config.param("retry_on_failure", :integer, default: 5),
|
26
26
|
"before_template_name" => config.param("before_template_name", :string, default: nil),
|
27
27
|
"before_template" => config.param("before_template", :hash, default: nil),
|
28
|
+
"current_index_name" => config.param("current_index_name", :string, default: nil),
|
28
29
|
}
|
29
30
|
task['time_value'] = Time.now.strftime('%Y.%m.%d.%H.%M.%S')
|
30
31
|
task['index'] = Time.now.strftime(task['index'])
|
31
32
|
|
33
|
+
task['current_index_name'] = if task['current_index_name']
|
34
|
+
task['current_index_name']
|
35
|
+
else
|
36
|
+
"#{task['index']}-#{task['index_type']}-#{task['time_value']}"
|
37
|
+
end
|
38
|
+
|
32
39
|
unless ENABLE_MODE.include?(task['mode'])
|
33
40
|
raise ConfigError.new "`mode` must be one of #{ENABLE_MODE.join(', ')}"
|
34
41
|
end
|
@@ -79,8 +86,7 @@ module Embulk
|
|
79
86
|
end
|
80
87
|
|
81
88
|
def self.delete_aliases(client, task)
|
82
|
-
indices = client.indices.
|
83
|
-
indices = indices.select { |index| /^#{get_index_prefix(task)}-(\d*)/ =~ index }
|
89
|
+
indices = client.indices.get_alias(name: task['index']).keys
|
84
90
|
indices.each { |index|
|
85
91
|
if index != get_index(task)
|
86
92
|
client.indices.delete_alias index: index, name: task['index']
|
@@ -94,11 +100,7 @@ module Embulk
|
|
94
100
|
end
|
95
101
|
|
96
102
|
def self.get_index(task)
|
97
|
-
task['mode'] == 'replace' ?
|
98
|
-
end
|
99
|
-
|
100
|
-
def self.get_index_prefix(task)
|
101
|
-
"#{task['index']}-#{task['index_type']}"
|
103
|
+
task['mode'] == 'replace' ? task['current_index_name'] : task['index']
|
102
104
|
end
|
103
105
|
|
104
106
|
#def self.resume(task, schema, count, &control)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-elasticsearch_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- toyama0919
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|