fluent-plugin-elasticsearch 2.8.0 → 2.8.1

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
  SHA256:
3
- metadata.gz: bdf35ea1b2e3e85372e0f5af8febdc9920e38090053b7e818d714d32d9df6428
4
- data.tar.gz: f43d98b89ee686f14bfe3b544f929cefc2b50d28d064cd9c40a3502aadf0774b
3
+ metadata.gz: 4ab0dd77a7749e31c5f80959ad351620d448c4127144a321385341e00884e2f1
4
+ data.tar.gz: '002829c47fa544b91eb9b5727718ac68a2aab7270a4567fdd9f3ca3039b8ff15'
5
5
  SHA512:
6
- metadata.gz: 8d4b5829f6bfcc13d8e25a60fca57422068a1449376690776dbe6623346ae058226563b215ad4926b97680b632515516309e6d50414d2d030e4d559359ae077a
7
- data.tar.gz: 763d3a4838093c99d92a2b4f3382335ff95ddd4e20d0c4a2378a42b3cb830a4c6654501662920035f9299a28e492372d5671792f0098f9f9e4566035d24533af
6
+ metadata.gz: 3630b2cf30675a1b0e397ba06d7f005c392dad90144e417d828373ed666d0fddff85167b7bfa57f37c1d1089b7d25b69fefdd9a8cf74068d01018dae17393a07
7
+ data.tar.gz: 196015f384b95ab35c73d4ddeaa2766a92242fd750a9d3432370317102cfbf4e756e7c181910f93cc39742cf8574e265b90720b458395cf576121464e8081b8b
data/History.md CHANGED
@@ -4,6 +4,9 @@
4
4
  - Log ES response errors (#230)
5
5
  - Use latest elasticsearch-ruby (#240)
6
6
 
7
+ ### 2.8.1
8
+ - Restore default value of type name #(377)
9
+
7
10
  ### 2.8.0
8
11
  - Remove outdated generating hash id support module (#373)
9
12
  - Check Elasticsearch major version (#371)
@@ -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 = '2.8.0'
6
+ s.version = '2.8.1'
7
7
  s.authors = ['diogo', 'pitr']
8
8
  s.email = ['pitr.vern@gmail.com', 'me@diogoterror.com']
9
9
  s.description = %q{Elasticsearch output plugin for Fluent event collector}
@@ -24,7 +24,8 @@ module Fluent::Plugin
24
24
 
25
25
  DEFAULT_BUFFER_TYPE = "memory"
26
26
  DEFAULT_ELASTICSEARCH_VERSION = 5 # For compatibility.
27
- DEFAULT_TYPE_NAME = "_doc".freeze
27
+ DEFAULT_TYPE_NAME_ES_7x = "_doc".freeze
28
+ DEFAULT_TYPE_NAME = "fluentd".freeze
28
29
 
29
30
  config_param :host, :string, :default => 'localhost'
30
31
  config_param :port, :integer, :default => 9200
@@ -156,7 +157,10 @@ EOC
156
157
  end
157
158
 
158
159
  @last_seen_major_version = detect_es_major_version rescue DEFAULT_ELASTICSEARCH_VERSION
159
- if @last_seen_major_version >= 7 && @type_name != DEFAULT_TYPE_NAME
160
+ if @last_seen_major_version == 6 && @type_name != DEFAULT_TYPE_NAME_ES_7x
161
+ log.info "Detected ES 6.x: ES 7.x will only accept `_doc` in type_name."
162
+ end
163
+ if @last_seen_major_version >= 7 && @type_name != DEFAULT_TYPE_NAME_ES_7x
160
164
  log.warn "Detected ES 7.x or above: `_doc` will be used as the document `_type`."
161
165
  @type_name = '_doc'.freeze
162
166
  end
@@ -427,7 +431,7 @@ EOC
427
431
  target_type = '_doc'.freeze
428
432
  end
429
433
  else
430
- if @last_seen_major_version >= 7 && target_type != DEFAULT_TYPE_NAME
434
+ if @last_seen_major_version >= 7 && target_type != DEFAULT_TYPE_NAME_ES_7x
431
435
  log.warn "Detected ES 7.x or above: `_doc` will be used as the document `_type`."
432
436
  target_type = '_doc'.freeze
433
437
  else
@@ -37,6 +37,10 @@ class ElasticsearchOutput < Test::Unit::TestCase
37
37
  }.configure(conf)
38
38
  end
39
39
 
40
+ def default_type_name
41
+ Fluent::Plugin::ElasticsearchOutput::DEFAULT_TYPE_NAME
42
+ end
43
+
40
44
  def sample_record
41
45
  {'age' => 26, 'request_id' => '42', 'parent_id' => 'parent', 'routing_id' => 'routing'}
42
46
  end
@@ -220,6 +224,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
220
224
  assert_nil instance.client_key_pass
221
225
  assert_false instance.with_transporter_log
222
226
  assert_equal :"application/x-ndjson", instance.content_type
227
+ assert_equal "fluentd", default_type_name
223
228
  end
224
229
 
225
230
  test 'configure Content-Type' do
@@ -665,7 +670,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
665
670
  driver.run(default_tag: 'test') do
666
671
  driver.feed(sample_record)
667
672
  end
668
- assert_equal('_doc', index_cmds.first['index']['_type'])
673
+ assert_equal(default_type_name, index_cmds.first['index']['_type'])
669
674
  end
670
675
 
671
676
  def test_writes_to_speficied_index
@@ -843,7 +848,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
843
848
 
844
849
  data("old" => {"es_version" => 2, "_type" => "local-override"},
845
850
  "old_behavior" => {"es_version" => 5, "_type" => "local-override"},
846
- "border" => {"es_version" => 6, "_type" => "_doc"},
851
+ "border" => {"es_version" => 6, "_type" => "fluentd"},
847
852
  "fixed_behavior"=> {"es_version" => 7, "_type" => "_doc"},
848
853
  )
849
854
  def test_writes_to_target_type_key(data)
@@ -865,7 +870,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
865
870
  driver.run(default_tag: 'test') do
866
871
  driver.feed(sample_record)
867
872
  end
868
- assert_equal('_doc', index_cmds.first['index']['_type'])
873
+ assert_equal(default_type_name, index_cmds.first['index']['_type'])
869
874
  end
870
875
 
871
876
  def test_writes_to_target_type_key_fallack_to_type_name
@@ -881,7 +886,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
881
886
 
882
887
  data("old" => {"es_version" => 2, "_type" => "local-override"},
883
888
  "old_behavior" => {"es_version" => 5, "_type" => "local-override"},
884
- "border" => {"es_version" => 6, "_type" => "_doc"},
889
+ "border" => {"es_version" => 6, "_type" => "fluentd"},
885
890
  "fixed_behavior"=> {"es_version" => 7, "_type" => "_doc"},
886
891
  )
887
892
  def test_writes_to_target_type_key_nested(data)
@@ -910,7 +915,7 @@ class ElasticsearchOutput < Test::Unit::TestCase
910
915
  }
911
916
  }))
912
917
  end
913
- assert_equal('_doc', index_cmds.first['index']['_type'])
918
+ assert_equal(default_type_name, index_cmds.first['index']['_type'])
914
919
  end
915
920
 
916
921
  def test_writes_to_speficied_host
@@ -34,6 +34,10 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
34
34
  }.configure(conf)
35
35
  end
36
36
 
37
+ def default_type_name
38
+ Fluent::Plugin::ElasticsearchOutput::DEFAULT_TYPE_NAME
39
+ end
40
+
37
41
  def sample_record
38
42
  {'age' => 26, 'request_id' => '42', 'parent_id' => 'parent', 'routing_id' => 'routing'}
39
43
  end
@@ -275,7 +279,7 @@ class ElasticsearchOutputDynamic < Test::Unit::TestCase
275
279
  driver.run(default_tag: 'test') do
276
280
  driver.feed(sample_record)
277
281
  end
278
- assert_equal('_doc', index_cmds.first['index']['_type'])
282
+ assert_equal(default_type_name, index_cmds.first['index']['_type'])
279
283
  end
280
284
 
281
285
  def test_writes_to_specified_index
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: 2.8.0
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - diogo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-03-05 00:00:00.000000000 Z
12
+ date: 2018-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd