embulk-output-elasticsearch_ruby 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a39cfe60830d7b5eef921678236f63b294c80cc
4
- data.tar.gz: 8c19d1d98c742dbdfea65c5a10bb45d8c0d1e5b8
3
+ metadata.gz: fa58203826c27f09b0718aef621215454a566ba8
4
+ data.tar.gz: 56df8f9037ab43256371ac5ce6676fd2b4090b51
5
5
  SHA512:
6
- metadata.gz: c2605199832fe17c37fc9e1e9afeca4d4acc29054b97c188f49cb7cddcbfebd2a408f3b7c54337b202b2f2d63a178e3719c35ea0548f96f935b7c9da6fc33333
7
- data.tar.gz: 8f7b3d9f33eae1a8cee0ef13f8518df4fe1bcb6fd5a8c0502390baff94683e43b7a3082e4f39fe5c5facf755e747c7fffacf904ce12bb762b7b9a64f8e6ed43f
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.2"
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.get_aliases.select { |key, value| value['aliases'].include? task['index'] }.keys
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' ? "#{get_index_prefix(task)}-#{task['time_value']}" : task['index']
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.2
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-15 00:00:00.000000000 Z
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