fluent-plugin-elasticsearch 5.4.0 → 5.4.2

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
  SHA256:
3
- metadata.gz: 4fc25cc0c5f9b35ce8ab9d733cbd4d908df838540f2bc5aad0fce57267f2c6d5
4
- data.tar.gz: 1179e1275edf74186b41c3ff004236a940df58b4c7214f2fe6e3a7ae3852cd81
3
+ metadata.gz: d654e4c24122a1f08b7440556ff43eca647e9aae360c4ebc43f4e29d7a8abfec
4
+ data.tar.gz: 961f8dab627d2628e854e4b6b64a30fb3719c8387dfd73a67aa6da8f059eb447
5
5
  SHA512:
6
- metadata.gz: 43f42f1611c24eb8ef00c153bf8ed4acc07da4a02535f5df6eecc44d9a2d219a15de1551131e7efeb80c8b8e2c20ef203302d95a2c1fe369d3996920654ec381
7
- data.tar.gz: 10de0f5a8e5c2179595a99b01a331cbc102c1d9529a59435d8f5c079236cf4132f86d05e552ae2e08e1bce88ec8eac8cd28c721c016a5cb17e13526cf5336d9e
6
+ metadata.gz: 78d3e7ab001e326c47a192798da97b9d44956db46869b807589818469b8c74cfc36bc936c67f2fdffed3c2f2967d4c9ede1737c8c6d774362f524861eee74186
7
+ data.tar.gz: 85e1144f3b227d28772cf785932a44bdf6d73307b7cc0401098acd97083b9638089d5a1e5ad2343cc9a7f64f4d93e274db99419fe07fdfe5b785176d667e6592
data/History.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### 5.4.1
6
+ - in\_elasticsearch: Avoid to use deprecated endpoint for clear\_scroll (#1039)
7
+
8
+ ### 5.4.1
9
+ - Adjust ilm endpoint (#1036)
10
+
5
11
  ### 5.4.0
6
12
  - Fix support for host/hosts placeholders for ipv6 addresses (#1030)
7
13
  - Handle newer es library (#1032)
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'fluent-plugin-elasticsearch'
6
- s.version = '5.4.0'
6
+ s.version = '5.4.2'
7
7
  s.authors = ['diogo', 'pitr', 'Hiroshi Hatake']
8
8
  s.email = ['pitr.vern@gmail.com', 'me@diogoterror.com', 'cosmo0920.wp@gmail.com']
9
9
  s.description = %q{Elasticsearch output plugin for Fluent event collector}
@@ -12,6 +12,7 @@ if Gem::Version.new(Elasticsearch::VERSION) < Gem::Version.new("8.0.0")
12
12
  begin
13
13
  require 'elasticsearch/xpack'
14
14
  rescue LoadError
15
+ require 'elasticsearch/api' # For elasticsearch-ruby 8 or later
15
16
  end
16
17
  end
17
18
 
@@ -45,19 +45,19 @@ module Fluent::Plugin::ElasticsearchIndexLifecycleManagement
45
45
  end
46
46
 
47
47
  def get_ilm_policy
48
- if Gem::Version.new(TRANSPORT_CLASS::VERSION) < Gem::Version.new("8.0.0")
49
- client.ilm.get_policy
48
+ if Gem::Version.new(Elasticsearch::VERSION) >= Gem::Version.new("8.0.0")
49
+ client.ilm.get_lifecycle
50
50
  else
51
- client.enrich.get_policy
51
+ client.ilm.get_policy
52
52
  end
53
53
  end
54
54
 
55
55
  def ilm_policy_exists?(policy_id)
56
56
  begin
57
- if Gem::Version.new(TRANSPORT_CLASS::VERSION) < Gem::Version.new("8.0.0")
58
- client.ilm.get_policy(policy_id: policy_id)
57
+ if Gem::Version.new(Elasticsearch::VERSION) >= Gem::Version.new("8.0.0")
58
+ client.ilm.get_lifecycle(policy: policy_id)
59
59
  else
60
- client.enrich.get_policy(name: policy_id)
60
+ client.ilm.get_policy(policy_id: policy_id)
61
61
  end
62
62
  true
63
63
  rescue
@@ -67,10 +67,10 @@ module Fluent::Plugin::ElasticsearchIndexLifecycleManagement
67
67
 
68
68
  def ilm_policy_put(policy_id, policy)
69
69
  log.info("Installing ILM policy: #{policy}")
70
- if Gem::Version.new(TRANSPORT_CLASS::VERSION) < Gem::Version.new("8.0.0")
71
- client.ilm.put_policy(policy_id: policy_id, body: policy)
70
+ if Gem::Version.new(Elasticsearch::VERSION) >= Gem::Version.new("8.0.0")
71
+ client.ilm.put_lifecycle(policy: policy_id, body: policy)
72
72
  else
73
- client.enrich.put_policy(name: policy_id, body: policy)
73
+ client.ilm.put_policy(policy_id: policy_id, body: policy)
74
74
  end
75
75
  end
76
76
 
@@ -286,7 +286,11 @@ module Fluent::Plugin
286
286
  end
287
287
 
288
288
  router.emit_stream(@tag, es)
289
- client.clear_scroll(scroll_id: scroll_id) if scroll_id
289
+ if Gem::Version.new(Elasticsearch::VERSION) >= Gem::Version.new("7.0.0")
290
+ client.clear_scroll(body: {scroll_id: scroll_id}) if scroll_id
291
+ else
292
+ client.clear_scroll(scroll_id: scroll_id) if scroll_id
293
+ end
290
294
  end
291
295
 
292
296
  def process_scroll_request(scroll_id)
@@ -102,8 +102,8 @@ module Fluent::Plugin
102
102
  retry_operate(@max_retry_putting_template,
103
103
  @fail_on_putting_template_retry_exceed,
104
104
  @catch_transport_exception_on_retry) do
105
- if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
106
- client(host).enrich.put_policy(params.merge(name: ilm_name))
105
+ if Gem::Version.new(Elasticsearch::VERSION) >= Gem::Version.new("8.0.0")
106
+ client(host).ilm.put_lifecycle(params.merge(policy: ilm_name))
107
107
  else
108
108
  client(host).xpack.ilm.put_policy(params.merge(policy_id: ilm_name))
109
109
  end
@@ -159,8 +159,8 @@ module Fluent::Plugin
159
159
 
160
160
  def ilm_policy_exists?(policy_id, host = nil)
161
161
  begin
162
- if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
163
- client(host).enrich.get_policy(name: policy_id)
162
+ if Gem::Version.new(Elasticsearch::VERSION) >= Gem::Version.new("8.0.0")
163
+ client(host).ilm.get_lifecycle(policy: policy_id)
164
164
  else
165
165
  client(host).ilm.get_policy(policy_id: policy_id)
166
166
  end
@@ -38,19 +38,15 @@ class TestElasticsearchIndexLifecycleManagement < Test::Unit::TestCase
38
38
  end
39
39
 
40
40
  def ilm_existence_endpoint(policy_id)
41
- if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
42
- "_enrich/policy/#{policy_id}"
41
+ if Gem::Version.new(Elasticsearch::VERSION) >= Gem::Version.new("8.0.0")
42
+ "_ilm/policy/#{policy_id}"
43
43
  else
44
44
  "_ilm/policy/%7B:policy_id=%3E%22#{policy_id}%22%7D"
45
45
  end
46
46
  end
47
47
 
48
48
  def ilm_creation_endpoint(policy_id)
49
- if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
50
- "_enrich/policy/#{policy_id}"
51
- else
52
- "_ilm/policy/#{policy_id}"
53
- end
49
+ "_ilm/policy/#{policy_id}"
54
50
  end
55
51
 
56
52
  def stub_elastic_info(url="http://localhost:9200/", version=elasticsearch_version)
@@ -463,9 +463,14 @@ class ElasticsearchInputTest < Test::Unit::TestCase
463
463
  headers: {'Content-Type' => 'application/json', 'X-elastic-product' => 'Elasticsearch'}}
464
464
  end
465
465
  end)
466
- stub_request(:delete, "http://localhost:9200/_search/scroll/WomkoUKG0QPB679Ulo6TqQgh3pIGRUmrl9qXXGK3EeiQh9rbYNasTkspZQcJ01uz").
466
+ if Gem::Version.new(Elasticsearch::VERSION) >= Gem::Version.new("7.0.0")
467
+ stub_request(:delete, "http://localhost:9200/_search/scroll").
468
+ with(body: "{\"scroll_id\":\"WomkoUKG0QPB679Ulo6TqQgh3pIGRUmrl9qXXGK3EeiQh9rbYNasTkspZQcJ01uz\"}").
467
469
  to_return(status: 200, body: "", headers: {})
468
-
470
+ else
471
+ stub_request(:delete, "http://localhost:9200/_search/scroll/WomkoUKG0QPB679Ulo6TqQgh3pIGRUmrl9qXXGK3EeiQh9rbYNasTkspZQcJ01uz").
472
+ to_return(status: 200, body: "", headers: {})
473
+ end
469
474
  driver(CONFIG + %[size 1])
470
475
  driver.run(expect_emits: 1, timeout: 10)
471
476
  expected = [
@@ -524,11 +524,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
524
524
  end
525
525
 
526
526
  def ilm_endpoint
527
- if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
528
- '_enrich'.freeze
529
- else
530
- '_ilm'.freeze
531
- end
527
+ '_ilm'.freeze
532
528
  end
533
529
 
534
530
  data("legacy_template" => [true, "_template"],
@@ -1179,11 +1175,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
1179
1175
  end
1180
1176
 
1181
1177
  def ilm_endpoint
1182
- if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
1183
- '_enrich'.freeze
1184
- else
1185
- '_ilm'.freeze
1186
- end
1178
+ '_ilm'.freeze
1187
1179
  end
1188
1180
 
1189
1181
  data("legacy_template" => [true, "_template"],
@@ -2601,11 +2593,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
2601
2593
 
2602
2594
 
2603
2595
  def ilm_endpoint
2604
- if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
2605
- '_enrich'.freeze
2606
- else
2607
- '_ilm'.freeze
2608
- end
2596
+ '_ilm'.freeze
2609
2597
  end
2610
2598
 
2611
2599
  data("legacy_template" => [true, "_template"],
@@ -31,11 +31,7 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
31
31
  end
32
32
 
33
33
  def ilm_endpoint
34
- if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
35
- '_enrich'.freeze
36
- else
37
- '_ilm'.freeze
38
- end
34
+ '_ilm'.freeze
39
35
  end
40
36
 
41
37
  def driver(conf='', es_version=elasticsearch_version.to_i, client_version=elasticsearch_version)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.0
4
+ version: 5.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - diogo
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-11-20 00:00:00.000000000 Z
13
+ date: 2023-12-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fluentd