fluent-plugin-elasticsearch 5.1.5 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/History.md +3 -0
- data/fluent-plugin-elasticsearch.gemspec +1 -1
- data/lib/fluent/plugin/elasticsearch_compat.rb +27 -0
- data/lib/fluent/plugin/elasticsearch_fallback_selector.rb +2 -2
- data/lib/fluent/plugin/elasticsearch_index_lifecycle_management.rb +18 -4
- data/lib/fluent/plugin/elasticsearch_index_template.rb +8 -4
- data/lib/fluent/plugin/elasticsearch_simple_sniffer.rb +2 -1
- data/lib/fluent/plugin/in_elasticsearch.rb +2 -1
- data/lib/fluent/plugin/oj_serializer.rb +2 -1
- data/lib/fluent/plugin/out_elasticsearch.rb +4 -7
- data/lib/fluent/plugin/out_elasticsearch_data_stream.rb +26 -11
- data/lib/fluent/plugin/out_elasticsearch_dynamic.rb +1 -1
- data/test/plugin/test_elasticsearch_fallback_selector.rb +15 -7
- data/test/plugin/test_elasticsearch_index_lifecycle_management.rb +47 -17
- data/test/plugin/test_in_elasticsearch.rb +10 -2
- data/test/plugin/test_out_elasticsearch.rb +220 -122
- data/test/plugin/test_out_elasticsearch_data_stream.rb +36 -19
- data/test/plugin/test_out_elasticsearch_dynamic.rb +57 -20
- metadata +3 -2
@@ -19,7 +19,15 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
19
19
|
log.out.logs.slice!(0, log.out.logs.length)
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def elasticsearch_version
|
23
|
+
if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("7.14.0")
|
24
|
+
TRANSPORT_CLASS::VERSION.split(".")[0..1].join(".")
|
25
|
+
else
|
26
|
+
"7.17".freeze
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def driver(conf='', es_version=elasticsearch_version.to_i, client_version="\"#{elasticsearch_version}\"")
|
23
31
|
# For request stub to detect compatibility.
|
24
32
|
@es_version ||= es_version
|
25
33
|
@client_version ||= client_version
|
@@ -46,7 +54,11 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
46
54
|
end
|
47
55
|
|
48
56
|
def elasticsearch_transport_layer_decoupling?
|
49
|
-
Gem::Version.create(::
|
57
|
+
Gem::Version.create(::TRANSPORT_CLASS::VERSION) >= Gem::Version.new("7.14.0")
|
58
|
+
end
|
59
|
+
|
60
|
+
def elastic_transport_layer?
|
61
|
+
Gem::Version.create(::TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
|
50
62
|
end
|
51
63
|
|
52
64
|
def default_type_name
|
@@ -63,9 +75,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
63
75
|
}
|
64
76
|
end
|
65
77
|
|
66
|
-
def stub_elastic_info(url="http://localhost:9200/", version=
|
78
|
+
def stub_elastic_info(url="http://localhost:9200/", version=elasticsearch_version)
|
67
79
|
body ="{\"version\":{\"number\":\"#{version}\", \"build_flavor\":\"default\"},\"tagline\" : \"You Know, for Search\"}"
|
68
|
-
stub_request(:get, url)
|
80
|
+
stub_request(:get, url)
|
81
|
+
.to_return({:status => 200, :body => body, :headers => { 'Content-Type' => 'json', 'X-elastic-product' => 'Elasticsearch' } })
|
69
82
|
end
|
70
83
|
|
71
84
|
def stub_elastic(url="http://localhost:9200/_bulk")
|
@@ -273,7 +286,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
273
286
|
end
|
274
287
|
|
275
288
|
test 'configure compression' do
|
276
|
-
omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::
|
289
|
+
omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.2.0")
|
277
290
|
|
278
291
|
config = %{
|
279
292
|
compression_level best_compression
|
@@ -284,7 +297,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
284
297
|
end
|
285
298
|
|
286
299
|
test 'check compression strategy' do
|
287
|
-
omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::
|
300
|
+
omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.2.0")
|
288
301
|
|
289
302
|
config = %{
|
290
303
|
compression_level best_speed
|
@@ -295,14 +308,16 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
295
308
|
end
|
296
309
|
|
297
310
|
test 'check content-encoding header with compression' do
|
298
|
-
omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::
|
311
|
+
omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.2.0")
|
299
312
|
|
300
313
|
config = %{
|
301
314
|
compression_level best_compression
|
302
315
|
}
|
303
316
|
instance = driver(config).instance
|
304
317
|
|
305
|
-
if
|
318
|
+
if elastic_transport_layer?
|
319
|
+
assert_equal nil, instance.client.transport.options[:transport_options][:headers]["Content-Encoding"]
|
320
|
+
elsif elasticsearch_transport_layer_decoupling?
|
306
321
|
assert_equal nil, instance.client.transport.transport.options[:transport_options][:headers]["Content-Encoding"]
|
307
322
|
else
|
308
323
|
assert_equal nil, instance.client.transport.options[:transport_options][:headers]["Content-Encoding"]
|
@@ -316,7 +331,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
316
331
|
end
|
317
332
|
compressable = instance.compressable_connection
|
318
333
|
|
319
|
-
if
|
334
|
+
if elastic_transport_layer?
|
335
|
+
assert_equal "gzip", instance.client(nil, compressable).transport.options[:transport_options][:headers]["Content-Encoding"]
|
336
|
+
elsif elasticsearch_transport_layer_decoupling?
|
320
337
|
assert_equal "gzip", instance.client(nil, compressable).transport.transport.options[:transport_options][:headers]["Content-Encoding"]
|
321
338
|
else
|
322
339
|
assert_equal "gzip", instance.client(nil, compressable).transport.options[:transport_options][:headers]["Content-Encoding"]
|
@@ -324,14 +341,16 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
324
341
|
end
|
325
342
|
|
326
343
|
test 'check compression option is passed to transport' do
|
327
|
-
omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::
|
344
|
+
omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.2.0")
|
328
345
|
|
329
346
|
config = %{
|
330
347
|
compression_level best_compression
|
331
348
|
}
|
332
349
|
instance = driver(config).instance
|
333
350
|
|
334
|
-
if
|
351
|
+
if elastic_transport_layer?
|
352
|
+
assert_equal false, instance.client.transport.options[:compression]
|
353
|
+
elsif elasticsearch_transport_layer_decoupling?
|
335
354
|
assert_equal false, instance.client.transport.transport.options[:compression]
|
336
355
|
else
|
337
356
|
assert_equal false, instance.client.transport.options[:compression]
|
@@ -345,7 +364,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
345
364
|
end
|
346
365
|
compressable = instance.compressable_connection
|
347
366
|
|
348
|
-
if
|
367
|
+
if elastic_transport_layer?
|
368
|
+
assert_equal true, instance.client(nil, compressable).transport.options[:compression]
|
369
|
+
elsif elasticsearch_transport_layer_decoupling?
|
349
370
|
assert_equal true, instance.client(nil, compressable).transport.transport.options[:compression]
|
350
371
|
else
|
351
372
|
assert_equal true, instance.client(nil, compressable).transport.options[:compression]
|
@@ -441,7 +462,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
441
462
|
end
|
442
463
|
|
443
464
|
test 'handle invalid client.info' do
|
444
|
-
stub_elastic_info_bad("https://logs.fluentd.com:24225/es//",
|
465
|
+
stub_elastic_info_bad("https://logs.fluentd.com:24225/es//", elasticsearch_version)
|
445
466
|
config = %{
|
446
467
|
host logs.fluentd.com
|
447
468
|
port 24225
|
@@ -453,7 +474,11 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
453
474
|
scheme https
|
454
475
|
@log_level info
|
455
476
|
}
|
456
|
-
if
|
477
|
+
if elastic_transport_layer?
|
478
|
+
assert_raise(NoMethodError) do
|
479
|
+
d = create_driver(config, 8, "\"8.0.0\"")
|
480
|
+
end
|
481
|
+
elsif elasticsearch_transport_layer_decoupling?
|
457
482
|
assert_raise(NoMethodError) do
|
458
483
|
d = create_driver(config, 7, "\"7.10.1\"")
|
459
484
|
end
|
@@ -481,21 +506,31 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
481
506
|
|
482
507
|
sub_test_case 'ILM default config' do
|
483
508
|
setup do
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
509
|
+
if Gem::Version.new(TRANSPORT_CLASS::VERSION) < Gem::Version.new("8.0.0")
|
510
|
+
begin
|
511
|
+
require "elasticsearch/xpack"
|
512
|
+
rescue LoadError
|
513
|
+
omit "ILM testcase needs elasticsearch-xpack gem."
|
514
|
+
end
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
518
|
+
def ilm_endpoint
|
519
|
+
if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
|
520
|
+
'_enrich'.freeze
|
521
|
+
else
|
522
|
+
'_ilm'.freeze
|
488
523
|
end
|
489
524
|
end
|
490
525
|
|
491
526
|
data("legacy_template" => [true, "_template"],
|
492
527
|
"new_template" => [false, "_index_template"])
|
493
528
|
test 'valid configuration of index lifecycle management' do |data|
|
494
|
-
if Gem::Version.create(::
|
529
|
+
if Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.4.0")
|
495
530
|
omit "elastisearch-ruby v7.4.0 or later is needed for ILM."
|
496
531
|
end
|
497
532
|
use_legacy_template_flag, endpoint = data
|
498
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
533
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
499
534
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
500
535
|
end
|
501
536
|
cwd = File.dirname(__FILE__)
|
@@ -519,9 +554,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
519
554
|
stub_request(:get, "http://localhost:9200/_xpack").
|
520
555
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}',
|
521
556
|
:headers => {"Content-Type"=> "application/json"})
|
522
|
-
stub_request(:get, "http://localhost:9200/
|
557
|
+
stub_request(:get, "http://localhost:9200/#{ilm_endpoint}/policy/logstash-policy").
|
523
558
|
to_return(status: 404, body: "", headers: {})
|
524
|
-
stub_request(:put, "http://localhost:9200/
|
559
|
+
stub_request(:put, "http://localhost:9200/#{ilm_endpoint}/policy/logstash-policy").
|
525
560
|
with(body: "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
526
561
|
to_return(status: 200, body: "", headers: {})
|
527
562
|
stub_elastic_info
|
@@ -534,11 +569,11 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
534
569
|
data("legacy_template" => [true, "_template"],
|
535
570
|
"new_template" => [false, "_index_template"])
|
536
571
|
test 'valid configuration of overwriting ilm_policy' do |data|
|
537
|
-
if Gem::Version.create(::
|
572
|
+
if Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.4.0")
|
538
573
|
omit "elastisearch-ruby v7.4.0 or later is needed for ILM."
|
539
574
|
end
|
540
575
|
use_legacy_template_flag, endpoint = data
|
541
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
576
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
542
577
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
543
578
|
end
|
544
579
|
cwd = File.dirname(__FILE__)
|
@@ -564,9 +599,9 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
564
599
|
stub_request(:get, "http://localhost:9200/_xpack").
|
565
600
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}',
|
566
601
|
:headers => {"Content-Type"=> "application/json"})
|
567
|
-
stub_request(:get, "http://localhost:9200/
|
602
|
+
stub_request(:get, "http://localhost:9200/#{ilm_endpoint}/policy/logstash-policy").
|
568
603
|
to_return(status: 200, body: "", headers: {})
|
569
|
-
stub_request(:put, "http://localhost:9200/
|
604
|
+
stub_request(:put, "http://localhost:9200/#{ilm_endpoint}/policy/logstash-policy").
|
570
605
|
with(body: "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"75gb\",\"max_age\":\"50d\"}}}}}}").
|
571
606
|
to_return(status: 200, body: "", headers: {})
|
572
607
|
stub_elastic_info
|
@@ -946,7 +981,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
946
981
|
"new_template" => [false, "_index_template"])
|
947
982
|
def test_template_already_present(data)
|
948
983
|
use_legacy_template_flag, endpoint = data
|
949
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
984
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
950
985
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
951
986
|
end
|
952
987
|
config = %{
|
@@ -980,7 +1015,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
980
1015
|
"new_template" => [false, "_index_template"])
|
981
1016
|
def test_template_create(data)
|
982
1017
|
use_legacy_template_flag, endpoint = data
|
983
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
1018
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
984
1019
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
985
1020
|
end
|
986
1021
|
cwd = File.dirname(__FILE__)
|
@@ -1025,7 +1060,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1025
1060
|
"new_template" => [false, "_index_template"])
|
1026
1061
|
def test_template_create_with_rollover_index_and_template_related_placeholders(data)
|
1027
1062
|
use_legacy_template_flag, endpoint = data
|
1028
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
1063
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
1029
1064
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
1030
1065
|
end
|
1031
1066
|
cwd = File.dirname(__FILE__)
|
@@ -1094,7 +1129,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1094
1129
|
"new_template" => [false, "_index_template"])
|
1095
1130
|
def test_template_create_with_rollover_index_and_template_related_placeholders_with_truncating_caches(data)
|
1096
1131
|
use_legacy_template_flag, endpoint = data
|
1097
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
1132
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
1098
1133
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
1099
1134
|
end
|
1100
1135
|
cwd = File.dirname(__FILE__)
|
@@ -1168,21 +1203,31 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1168
1203
|
|
1169
1204
|
class TemplateIndexLifecycleManagementTest < self
|
1170
1205
|
def setup
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1206
|
+
if Gem::Version.new(Elasticsearch::VERSION) < Gem::Version.new("8.0.0")
|
1207
|
+
begin
|
1208
|
+
require "elasticsearch/xpack"
|
1209
|
+
rescue LoadError
|
1210
|
+
omit "ILM testcase needs elasticsearch-xpack gem."
|
1211
|
+
end
|
1175
1212
|
end
|
1176
|
-
if Gem::Version.create(::
|
1213
|
+
if Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.4.0")
|
1177
1214
|
omit "elastisearch-ruby v7.4.0 or later is needed for ILM."
|
1178
1215
|
end
|
1179
1216
|
end
|
1180
1217
|
|
1218
|
+
def ilm_endpoint
|
1219
|
+
if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
|
1220
|
+
'_enrich'.freeze
|
1221
|
+
else
|
1222
|
+
'_ilm'.freeze
|
1223
|
+
end
|
1224
|
+
end
|
1225
|
+
|
1181
1226
|
data("legacy_template" => [true, "_template"],
|
1182
1227
|
"new_template" => [false, "_index_template"])
|
1183
1228
|
def test_template_create_with_rollover_index_and_default_ilm(data)
|
1184
1229
|
use_legacy_template_flag, endpoint = data
|
1185
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
1230
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
1186
1231
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
1187
1232
|
end
|
1188
1233
|
cwd = File.dirname(__FILE__)
|
@@ -1248,10 +1293,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1248
1293
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1249
1294
|
with(basic_auth: ['john', 'doe']).
|
1250
1295
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1251
|
-
stub_request(:get, "https://logs.google.com:777/es
|
1296
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1252
1297
|
with(basic_auth: ['john', 'doe']).
|
1253
1298
|
to_return(:status => 404, :body => "", :headers => {})
|
1254
|
-
stub_request(:put, "https://logs.google.com:777/es
|
1299
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1255
1300
|
with(basic_auth: ['john', 'doe'],
|
1256
1301
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
1257
1302
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -1266,7 +1311,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1266
1311
|
"new_template" => [false, "_index_template"])
|
1267
1312
|
def test_template_create_with_rollover_index_and_default_ilm_on_logstash_format(data)
|
1268
1313
|
use_legacy_template_flag, endpoint = data
|
1269
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
1314
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
1270
1315
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
1271
1316
|
end
|
1272
1317
|
cwd = File.dirname(__FILE__)
|
@@ -1335,10 +1380,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1335
1380
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1336
1381
|
with(basic_auth: ['john', 'doe']).
|
1337
1382
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1338
|
-
stub_request(:get, "https://logs.google.com:777/es
|
1383
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1339
1384
|
with(basic_auth: ['john', 'doe']).
|
1340
1385
|
to_return(:status => 404, :body => "", :headers => {})
|
1341
|
-
stub_request(:put, "https://logs.google.com:777/es
|
1386
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1342
1387
|
with(basic_auth: ['john', 'doe'],
|
1343
1388
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
1344
1389
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -1359,7 +1404,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1359
1404
|
"new_template" => [false, "_index_template"])
|
1360
1405
|
def test_template_create_with_rollover_index_and_default_ilm_and_ilm_policy_overwrite(data)
|
1361
1406
|
use_legacy_template_flag, endpoint = data
|
1362
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
1407
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
1363
1408
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
1364
1409
|
end
|
1365
1410
|
cwd = File.dirname(__FILE__)
|
@@ -1427,10 +1472,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1427
1472
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1428
1473
|
with(basic_auth: ['john', 'doe']).
|
1429
1474
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1430
|
-
stub_request(:get, "https://logs.google.com:777/es
|
1475
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1431
1476
|
with(basic_auth: ['john', 'doe']).
|
1432
1477
|
to_return(:status => 200, :body => "", :headers => {})
|
1433
|
-
stub_request(:put, "https://logs.google.com:777/es
|
1478
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1434
1479
|
with(basic_auth: ['john', 'doe'],
|
1435
1480
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"60gb\",\"max_age\":\"45d\"}}}}}}").
|
1436
1481
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -1470,7 +1515,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1470
1515
|
"new_template" => [false, "_index_template"])
|
1471
1516
|
def test_template_create_with_rollover_index_and_default_ilm_with_empty_index_date_pattern(data)
|
1472
1517
|
use_legacy_template_flag, endpoint = data
|
1473
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
1518
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
1474
1519
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
1475
1520
|
end
|
1476
1521
|
cwd = File.dirname(__FILE__)
|
@@ -1536,10 +1581,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1536
1581
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1537
1582
|
with(basic_auth: ['john', 'doe']).
|
1538
1583
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1539
|
-
stub_request(:get, "https://logs.google.com:777/es
|
1584
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1540
1585
|
with(basic_auth: ['john', 'doe']).
|
1541
1586
|
to_return(:status => 404, :body => "", :headers => {})
|
1542
|
-
stub_request(:put, "https://logs.google.com:777/es
|
1587
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1543
1588
|
with(basic_auth: ['john', 'doe'],
|
1544
1589
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
1545
1590
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -1554,7 +1599,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1554
1599
|
"new_template" => [false, "_index_template"])
|
1555
1600
|
def test_template_create_with_rollover_index_and_custom_ilm(data)
|
1556
1601
|
use_legacy_template_flag, endpoint = data
|
1557
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
1602
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
1558
1603
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
1559
1604
|
end
|
1560
1605
|
cwd = File.dirname(__FILE__)
|
@@ -1621,10 +1666,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1621
1666
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1622
1667
|
with(basic_auth: ['john', 'doe']).
|
1623
1668
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1624
|
-
stub_request(:get, "https://logs.google.com:777/es
|
1669
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
1625
1670
|
with(basic_auth: ['john', 'doe']).
|
1626
1671
|
to_return(:status => 404, :body => "", :headers => {})
|
1627
|
-
stub_request(:put, "https://logs.google.com:777/es
|
1672
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
1628
1673
|
with(basic_auth: ['john', 'doe'],
|
1629
1674
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"70gb\",\"max_age\":\"30d\"}}}}}}").
|
1630
1675
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -1639,7 +1684,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1639
1684
|
"new_template" => [false, "_index_template"])
|
1640
1685
|
def test_template_create_with_rollover_index_and_ilm_policies_and_placeholderstest_template_create_with_rollover_index_and_ilm_policies_and_placeholders(data)
|
1641
1686
|
use_legacy_template_flag, endpoint = data
|
1642
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
1687
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
1643
1688
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
1644
1689
|
end
|
1645
1690
|
cwd = File.dirname(__FILE__)
|
@@ -1706,10 +1751,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1706
1751
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1707
1752
|
with(basic_auth: ['john', 'doe']).
|
1708
1753
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1709
|
-
stub_request(:get, "https://logs.google.com:777/es
|
1754
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
1710
1755
|
with(basic_auth: ['john', 'doe']).
|
1711
1756
|
to_return(:status => 404, :body => "", :headers => {})
|
1712
|
-
stub_request(:put, "https://logs.google.com:777/es
|
1757
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
1713
1758
|
with(basic_auth: ['john', 'doe'],
|
1714
1759
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"70gb\",\"max_age\":\"30d\"}}}}}}").
|
1715
1760
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -1731,7 +1776,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1731
1776
|
"new_template" => [false, "_index_template"])
|
1732
1777
|
def test_tag_placeholder(data)
|
1733
1778
|
use_legacy_template_flag, endpoint = data
|
1734
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
1779
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
1735
1780
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
1736
1781
|
end
|
1737
1782
|
cwd = File.dirname(__FILE__)
|
@@ -1798,10 +1843,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1798
1843
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1799
1844
|
with(basic_auth: ['john', 'doe']).
|
1800
1845
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1801
|
-
stub_request(:get, "https://logs.google.com:777/es
|
1846
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
1802
1847
|
with(basic_auth: ['john', 'doe']).
|
1803
1848
|
to_return(:status => 404, :body => "", :headers => {})
|
1804
|
-
stub_request(:put, "https://logs.google.com:777/es
|
1849
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
1805
1850
|
with(basic_auth: ['john', 'doe'],
|
1806
1851
|
body: "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"70gb\",\"max_age\":\"30d\"}}}}}}").
|
1807
1852
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -1822,7 +1867,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1822
1867
|
"new_template" => [false, "_index_template"])
|
1823
1868
|
def test_tag_placeholder_with_multiple_policies(data)
|
1824
1869
|
use_legacy_template_flag, endpoint = data
|
1825
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
1870
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
1826
1871
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
1827
1872
|
end
|
1828
1873
|
cwd = File.dirname(__FILE__)
|
@@ -1889,10 +1934,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1889
1934
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1890
1935
|
with(basic_auth: ['john', 'doe']).
|
1891
1936
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1892
|
-
stub_request(:get, "https://logs.google.com:777/es
|
1937
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy2").
|
1893
1938
|
with(basic_auth: ['john', 'doe']).
|
1894
1939
|
to_return(:status => 404, :body => "", :headers => {})
|
1895
|
-
stub_request(:put, "https://logs.google.com:777/es
|
1940
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy2").
|
1896
1941
|
with(basic_auth: ['john', 'doe'],
|
1897
1942
|
body: "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"80gb\",\"max_age\":\"20d\"}}}}}}").
|
1898
1943
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -1914,7 +1959,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1914
1959
|
"new_template" => [false, "_index_template"])
|
1915
1960
|
def test_template_create_with_rollover_index_and_default_ilm_and_placeholders(data)
|
1916
1961
|
use_legacy_template_flag, endpoint = data
|
1917
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
1962
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
1918
1963
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
1919
1964
|
end
|
1920
1965
|
cwd = File.dirname(__FILE__)
|
@@ -1980,10 +2025,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1980
2025
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1981
2026
|
with(basic_auth: ['john', 'doe']).
|
1982
2027
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1983
|
-
stub_request(:get, "https://logs.google.com:777/es
|
2028
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1984
2029
|
with(basic_auth: ['john', 'doe']).
|
1985
2030
|
to_return(:status => 404, :body => "", :headers => {})
|
1986
|
-
stub_request(:put, "https://logs.google.com:777/es
|
2031
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1987
2032
|
with(basic_auth: ['john', 'doe'],
|
1988
2033
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
1989
2034
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -2015,10 +2060,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2015
2060
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2016
2061
|
with(basic_auth: ['john', 'doe']).
|
2017
2062
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2018
|
-
stub_request(:get, "https://logs.google.com:777/es
|
2063
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
2019
2064
|
with(basic_auth: ['john', 'doe']).
|
2020
2065
|
to_return(:status => 404, :body => "", :headers => {})
|
2021
|
-
stub_request(:put, "https://logs.google.com:777/es
|
2066
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
2022
2067
|
with(basic_auth: ['john', 'doe'],
|
2023
2068
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
2024
2069
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -2045,7 +2090,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2045
2090
|
"new_template" => [false, "_index_template"])
|
2046
2091
|
def test_template_create_with_rollover_index_and_default_ilm_and_placeholders_and_index_separator(data)
|
2047
2092
|
use_legacy_template_flag, endpoint = data
|
2048
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
2093
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
2049
2094
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
2050
2095
|
end
|
2051
2096
|
cwd = File.dirname(__FILE__)
|
@@ -2112,10 +2157,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2112
2157
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2113
2158
|
with(basic_auth: ['john', 'doe']).
|
2114
2159
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2115
|
-
stub_request(:get, "https://logs.google.com:777/es
|
2160
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
2116
2161
|
with(basic_auth: ['john', 'doe']).
|
2117
2162
|
to_return(:status => 404, :body => "", :headers => {})
|
2118
|
-
stub_request(:put, "https://logs.google.com:777/es
|
2163
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
2119
2164
|
with(basic_auth: ['john', 'doe'],
|
2120
2165
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
2121
2166
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -2138,7 +2183,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2138
2183
|
"new_template" => [false, "_index_template"])
|
2139
2184
|
def test_template_create_with_rollover_index_and_default_ilm_and_custom_and_time_placeholders(data)
|
2140
2185
|
use_legacy_template_flag, endpoint = data
|
2141
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
2186
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
2142
2187
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
2143
2188
|
end
|
2144
2189
|
cwd = File.dirname(__FILE__)
|
@@ -2209,10 +2254,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2209
2254
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2210
2255
|
with(basic_auth: ['john', 'doe']).
|
2211
2256
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2212
|
-
stub_request(:get, "https://logs.google.com:777/es
|
2257
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
2213
2258
|
with(basic_auth: ['john', 'doe']).
|
2214
2259
|
to_return(:status => 404, :body => "", :headers => {})
|
2215
|
-
stub_request(:put, "https://logs.google.com:777/es
|
2260
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
2216
2261
|
with(basic_auth: ['john', 'doe'],
|
2217
2262
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
2218
2263
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -2237,7 +2282,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2237
2282
|
def test_custom_template_create(data)
|
2238
2283
|
use_legacy_template_flag, endpoint = data
|
2239
2284
|
|
2240
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
2285
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
2241
2286
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
2242
2287
|
end
|
2243
2288
|
cwd = File.dirname(__FILE__)
|
@@ -2283,7 +2328,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2283
2328
|
"new_template" => [false, "_index_template"])
|
2284
2329
|
def test_custom_template_create_with_customize_template_related_placeholders(data)
|
2285
2330
|
use_legacy_template_flag, endpoint = data
|
2286
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
2331
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
2287
2332
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
2288
2333
|
end
|
2289
2334
|
cwd = File.dirname(__FILE__)
|
@@ -2337,7 +2382,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2337
2382
|
"new_template" => [false, "_index_template"])
|
2338
2383
|
def test_custom_template_installation_for_host_placeholder(data)
|
2339
2384
|
use_legacy_template_flag, endpoint = data
|
2340
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
2385
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
2341
2386
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
2342
2387
|
end
|
2343
2388
|
cwd = File.dirname(__FILE__)
|
@@ -2387,7 +2432,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2387
2432
|
"new_template" => [false, "_index_template"])
|
2388
2433
|
def test_custom_template_with_rollover_index_create(data)
|
2389
2434
|
use_legacy_template_flag, endpoint = data
|
2390
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
2435
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
2391
2436
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
2392
2437
|
end
|
2393
2438
|
cwd = File.dirname(__FILE__)
|
@@ -2449,7 +2494,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2449
2494
|
"new_template" => [false, "_index_template"])
|
2450
2495
|
def test_custom_template_with_rollover_index_create_and_deflector_alias(data)
|
2451
2496
|
use_legacy_template_flag, endpoint = data
|
2452
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
2497
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
2453
2498
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
2454
2499
|
end
|
2455
2500
|
cwd = File.dirname(__FILE__)
|
@@ -2512,7 +2557,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2512
2557
|
"new_template" => [false, "_index_template"])
|
2513
2558
|
def test_custom_template_with_rollover_index_create_with_logstash_format(data)
|
2514
2559
|
use_legacy_template_flag, endpoint = data
|
2515
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
2560
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
2516
2561
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
2517
2562
|
end
|
2518
2563
|
cwd = File.dirname(__FILE__)
|
@@ -2579,21 +2624,32 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2579
2624
|
|
2580
2625
|
class CustomTemplateIndexLifecycleManagementTest < self
|
2581
2626
|
def setup
|
2582
|
-
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2627
|
+
if Gem::Version.new(TRANSPORT_CLASS::VERSION) < Gem::Version.new("8.0.0")
|
2628
|
+
begin
|
2629
|
+
require "elasticsearch/xpack"
|
2630
|
+
rescue LoadError
|
2631
|
+
omit "ILM testcase needs elasticsearch-xpack gem."
|
2632
|
+
end
|
2586
2633
|
end
|
2587
|
-
if Gem::Version.create(::
|
2634
|
+
if Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.4.0")
|
2588
2635
|
omit "elastisearch-ruby v7.4.0 or later is needed."
|
2589
2636
|
end
|
2590
2637
|
end
|
2591
2638
|
|
2639
|
+
|
2640
|
+
def ilm_endpoint
|
2641
|
+
if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
|
2642
|
+
'_enrich'.freeze
|
2643
|
+
else
|
2644
|
+
'_ilm'.freeze
|
2645
|
+
end
|
2646
|
+
end
|
2647
|
+
|
2592
2648
|
data("legacy_template" => [true, "_template"],
|
2593
2649
|
"new_template" => [false, "_index_template"])
|
2594
2650
|
def test_custom_template_with_rollover_index_create_and_default_ilm(data)
|
2595
2651
|
use_legacy_template_flag, endpoint = data
|
2596
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
2652
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
2597
2653
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
2598
2654
|
end
|
2599
2655
|
cwd = File.dirname(__FILE__)
|
@@ -2663,10 +2719,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2663
2719
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2664
2720
|
with(basic_auth: ['john', 'doe']).
|
2665
2721
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2666
|
-
stub_request(:get, "https://logs.google.com:777/es
|
2722
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2667
2723
|
with(basic_auth: ['john', 'doe']).
|
2668
2724
|
to_return(:status => 404, :body => "", :headers => {})
|
2669
|
-
stub_request(:put, "https://logs.google.com:777/es
|
2725
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2670
2726
|
with(basic_auth: ['john', 'doe'],
|
2671
2727
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
2672
2728
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -2680,7 +2736,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2680
2736
|
"new_template" => [false, "_index_template"])
|
2681
2737
|
def test_custom_template_with_rollover_index_create_and_default_ilm_and_ilm_policy_overwrite(data)
|
2682
2738
|
use_legacy_template_flag, endpoint = data
|
2683
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
2739
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
2684
2740
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
2685
2741
|
end
|
2686
2742
|
cwd = File.dirname(__FILE__)
|
@@ -2752,10 +2808,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2752
2808
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2753
2809
|
with(basic_auth: ['john', 'doe']).
|
2754
2810
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2755
|
-
stub_request(:get, "https://logs.google.com:777/es
|
2811
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2756
2812
|
with(basic_auth: ['john', 'doe']).
|
2757
2813
|
to_return(:status => 200, :body => "", :headers => {})
|
2758
|
-
stub_request(:put, "https://logs.google.com:777/es
|
2814
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2759
2815
|
with(basic_auth: ['john', 'doe'],
|
2760
2816
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"60gb\",\"max_age\":\"45d\"}}}}}}").
|
2761
2817
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -2799,7 +2855,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2799
2855
|
"new_template" => [false, "_index_template"])
|
2800
2856
|
def test_custom_template_with_rollover_index_create_and_default_ilm_and_placeholders(data)
|
2801
2857
|
use_legacy_template_flag, endpoint = data
|
2802
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
2858
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
2803
2859
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
2804
2860
|
end
|
2805
2861
|
cwd = File.dirname(__FILE__)
|
@@ -2871,10 +2927,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2871
2927
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2872
2928
|
with(basic_auth: ['john', 'doe']).
|
2873
2929
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2874
|
-
stub_request(:get, "https://logs.google.com:777/es
|
2930
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2875
2931
|
with(basic_auth: ['john', 'doe']).
|
2876
2932
|
to_return(:status => 404, :body => "", :headers => {})
|
2877
|
-
stub_request(:put, "https://logs.google.com:777/es
|
2933
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2878
2934
|
with(basic_auth: ['john', 'doe'],
|
2879
2935
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
2880
2936
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -2918,10 +2974,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2918
2974
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2919
2975
|
with(basic_auth: ['john', 'doe']).
|
2920
2976
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2921
|
-
stub_request(:get, "https://logs.google.com:777/es
|
2977
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2922
2978
|
with(basic_auth: ['john', 'doe']).
|
2923
2979
|
to_return(:status => 404, :body => "", :headers => {})
|
2924
|
-
stub_request(:put, "https://logs.google.com:777/es
|
2980
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2925
2981
|
with(basic_auth: ['john', 'doe'],
|
2926
2982
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
2927
2983
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -2946,7 +3002,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2946
3002
|
"new_template" => [false, "_index_template"])
|
2947
3003
|
def test_custom_template_with_rollover_index_create_and_custom_ilm(data)
|
2948
3004
|
use_legacy_template_flag, endpoint = data
|
2949
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
3005
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
2950
3006
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
2951
3007
|
end
|
2952
3008
|
cwd = File.dirname(__FILE__)
|
@@ -3009,10 +3065,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3009
3065
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
3010
3066
|
with(basic_auth: ['john', 'doe']).
|
3011
3067
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
3012
|
-
stub_request(:get, "https://logs.google.com:777/es
|
3068
|
+
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
3013
3069
|
with(basic_auth: ['john', 'doe']).
|
3014
3070
|
to_return(:status => 404, :body => "", :headers => {})
|
3015
|
-
stub_request(:put, "https://logs.google.com:777/es
|
3071
|
+
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
3016
3072
|
with(basic_auth: ['john', 'doe'],
|
3017
3073
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"70gb\",\"max_age\":\"30d\"}}}}}}").
|
3018
3074
|
to_return(:status => 200, :body => "", :headers => {})
|
@@ -3027,7 +3083,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3027
3083
|
"new_template" => [false, "_index_template"])
|
3028
3084
|
def test_template_overwrite(data)
|
3029
3085
|
use_legacy_template_flag, endpoint = data
|
3030
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
3086
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
3031
3087
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
3032
3088
|
end
|
3033
3089
|
cwd = File.dirname(__FILE__)
|
@@ -3073,7 +3129,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3073
3129
|
"new_template" => [false, "_index_template"])
|
3074
3130
|
def test_custom_template_overwrite(data)
|
3075
3131
|
use_legacy_template_flag, endpoint = data
|
3076
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
3132
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
3077
3133
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
3078
3134
|
end
|
3079
3135
|
cwd = File.dirname(__FILE__)
|
@@ -3120,7 +3176,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3120
3176
|
"new_template" => [false, "_index_template"])
|
3121
3177
|
def test_custom_template_with_rollover_index_overwrite(data)
|
3122
3178
|
use_legacy_template_flag, endpoint = data
|
3123
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
3179
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
3124
3180
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
3125
3181
|
end
|
3126
3182
|
cwd = File.dirname(__FILE__)
|
@@ -3210,7 +3266,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3210
3266
|
"new_template" => [false, "_index_template"])
|
3211
3267
|
def test_template_create_for_host_placeholder(data)
|
3212
3268
|
use_legacy_template_flag, endpoint = data
|
3213
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
3269
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
3214
3270
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
3215
3271
|
end
|
3216
3272
|
cwd = File.dirname(__FILE__)
|
@@ -3262,7 +3318,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3262
3318
|
"new_template" => [false, "_index_template"])
|
3263
3319
|
def test_template_retry_install_fails(data)
|
3264
3320
|
use_legacy_template_flag, endpoint = data
|
3265
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
3321
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
3266
3322
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
3267
3323
|
end
|
3268
3324
|
cwd = File.dirname(__FILE__)
|
@@ -3301,13 +3357,13 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3301
3357
|
assert_equal(4, connection_resets)
|
3302
3358
|
end
|
3303
3359
|
|
3304
|
-
transport_errors_handled_separately = [
|
3305
|
-
transport_errors =
|
3360
|
+
transport_errors_handled_separately = [TRANSPORT_CLASS::Transport::Errors::NotFound]
|
3361
|
+
transport_errors = TRANSPORT_CLASS::Transport::Errors.constants.map { |err| [err, TRANSPORT_CLASS::Transport::Errors.const_get(err)] }
|
3306
3362
|
transport_errors_hash = Hash[transport_errors.select { |err| !transport_errors_handled_separately.include?(err[1]) } ]
|
3307
3363
|
|
3308
3364
|
data(transport_errors_hash)
|
3309
3365
|
def test_template_retry_transport_errors(error)
|
3310
|
-
endpoint, use_legacy_template_flag = if Gem::Version.create(::
|
3366
|
+
endpoint, use_legacy_template_flag = if Gem::Version.create(::TRANSPORT_CLASS::VERSION) >= Gem::Version.create("7.8.0")
|
3311
3367
|
["_index_template".freeze, false]
|
3312
3368
|
else
|
3313
3369
|
["_template".freeze, true]
|
@@ -3347,7 +3403,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3347
3403
|
"new_template" => [false, "_index_template"])
|
3348
3404
|
def test_template_retry_install_does_not_fail(data)
|
3349
3405
|
use_legacy_template_flag, endpoint = data
|
3350
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
3406
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
3351
3407
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
3352
3408
|
end
|
3353
3409
|
cwd = File.dirname(__FILE__)
|
@@ -3389,7 +3445,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3389
3445
|
"new_template" => [false, "_index_template"])
|
3390
3446
|
def test_templates_create(data)
|
3391
3447
|
use_legacy_template_flag, endpoint = data
|
3392
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
3448
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
3393
3449
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
3394
3450
|
end
|
3395
3451
|
cwd = File.dirname(__FILE__)
|
@@ -3447,7 +3503,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3447
3503
|
"new_template" => [false, "_index_template"])
|
3448
3504
|
def test_templates_overwrite(data)
|
3449
3505
|
use_legacy_template_flag, endpoint = data
|
3450
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
3506
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
3451
3507
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
3452
3508
|
end
|
3453
3509
|
cwd = File.dirname(__FILE__)
|
@@ -3505,7 +3561,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3505
3561
|
"new_template" => [false, "_index_template"])
|
3506
3562
|
def test_templates_are_also_used(data)
|
3507
3563
|
use_legacy_template_flag, endpoint = data
|
3508
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
3564
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
3509
3565
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
3510
3566
|
end
|
3511
3567
|
cwd = File.dirname(__FILE__)
|
@@ -3565,7 +3621,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3565
3621
|
"new_template" => [false, "_index_template"])
|
3566
3622
|
def test_templates_can_be_partially_created_if_error_occurs(data)
|
3567
3623
|
use_legacy_template_flag, endpoint = data
|
3568
|
-
if !use_legacy_template_flag && Gem::Version.create(::
|
3624
|
+
if !use_legacy_template_flag && Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.8.0")
|
3569
3625
|
omit "elastisearch-ruby v7.8.0 or later is needed."
|
3570
3626
|
end
|
3571
3627
|
cwd = File.dirname(__FILE__)
|
@@ -3946,7 +4002,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3946
4002
|
|
3947
4003
|
|
3948
4004
|
def test_writes_to_default_index_with_compression
|
3949
|
-
omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::
|
4005
|
+
omit "elastisearch-ruby v7.2.0 or later is needed." if Gem::Version.create(::TRANSPORT_CLASS::VERSION) < Gem::Version.create("7.2.0")
|
3950
4006
|
|
3951
4007
|
config = %[
|
3952
4008
|
compression_level default_compression
|
@@ -4037,9 +4093,16 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
4037
4093
|
}, [])
|
4038
4094
|
]
|
4039
4095
|
))
|
4096
|
+
index_part = if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
|
4097
|
+
'{"index":{"_index":"fluentd"}}'
|
4098
|
+
elsif Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("7.0.0")
|
4099
|
+
'{"index":{"_index":"fluentd","_type":"_doc"}}'
|
4100
|
+
else
|
4101
|
+
'{"index":{"_index":"fluentd","_type":"fluentd"}}'
|
4102
|
+
end
|
4040
4103
|
stub_request(:post, "http://localhost:9200/_bulk").
|
4041
4104
|
with(
|
4042
|
-
body:
|
4105
|
+
body: /#{index_part}\n{"age":26,"request_id":"42","parent_id":"parent","routing_id":"routing","#{chunk_id_key}":".*"}\n/) do |req|
|
4043
4106
|
@index_cmds = req.body.split("\n").map {|r| JSON.parse(r) }
|
4044
4107
|
end
|
4045
4108
|
stub_elastic_info
|
@@ -4524,7 +4587,13 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
4524
4587
|
driver.run(default_tag: 'test') do
|
4525
4588
|
driver.feed(sample_record)
|
4526
4589
|
end
|
4527
|
-
|
4590
|
+
if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
|
4591
|
+
assert_nil(index_cmds.first['index']['_type'])
|
4592
|
+
elsif Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("7.0.0")
|
4593
|
+
assert_equal("_doc", index_cmds.first['index']['_type'])
|
4594
|
+
else
|
4595
|
+
assert_equal("fluentd", index_cmds.first['index']['_type'])
|
4596
|
+
end
|
4528
4597
|
end
|
4529
4598
|
|
4530
4599
|
def test_writes_to_target_type_key_fallack_to_type_name
|
@@ -4535,7 +4604,13 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
4535
4604
|
driver.run(default_tag: 'test') do
|
4536
4605
|
driver.feed(sample_record)
|
4537
4606
|
end
|
4538
|
-
|
4607
|
+
if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
|
4608
|
+
assert_nil(index_cmds.first['index']['_type'])
|
4609
|
+
elsif Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("7.0.0")
|
4610
|
+
assert_equal("_doc", index_cmds.first['index']['_type'])
|
4611
|
+
else
|
4612
|
+
assert_equal("fluentd", index_cmds.first['index']['_type'])
|
4613
|
+
end
|
4539
4614
|
end
|
4540
4615
|
|
4541
4616
|
data("old" => {"es_version" => 2, "_type" => "local-override"},
|
@@ -4569,7 +4644,13 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
4569
4644
|
}
|
4570
4645
|
}))
|
4571
4646
|
end
|
4572
|
-
|
4647
|
+
if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
|
4648
|
+
assert_nil(index_cmds.first['index']['_type'])
|
4649
|
+
elsif Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("7.0.0")
|
4650
|
+
assert_equal("_doc", index_cmds.first['index']['_type'])
|
4651
|
+
else
|
4652
|
+
assert_equal("fluentd", index_cmds.first['index']['_type'])
|
4653
|
+
end
|
4573
4654
|
end
|
4574
4655
|
|
4575
4656
|
def test_writes_to_speficied_host
|
@@ -5410,7 +5491,8 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5410
5491
|
driver.run(default_tag: 'test') do
|
5411
5492
|
driver.feed(sample_record)
|
5412
5493
|
end
|
5413
|
-
|
5494
|
+
routing_key = driver.instance.instance_variable_get(:@routing_key_name)
|
5495
|
+
assert_equal('routing', index_cmds[0]['index'][routing_key])
|
5414
5496
|
end
|
5415
5497
|
|
5416
5498
|
def test_es7
|
@@ -5420,7 +5502,8 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5420
5502
|
driver.run(default_tag: 'test') do
|
5421
5503
|
driver.feed(sample_record)
|
5422
5504
|
end
|
5423
|
-
|
5505
|
+
routing_key = driver.instance.instance_variable_get(:@routing_key_name)
|
5506
|
+
assert_equal('routing', index_cmds[0]['index'][routing_key])
|
5424
5507
|
end
|
5425
5508
|
end
|
5426
5509
|
|
@@ -5432,7 +5515,8 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5432
5515
|
driver.run(default_tag: 'test') do
|
5433
5516
|
driver.feed(nested_sample_record)
|
5434
5517
|
end
|
5435
|
-
|
5518
|
+
routing_key = driver.instance.instance_variable_get(:@routing_key_name)
|
5519
|
+
assert_equal('routing', index_cmds[0]['index'][routing_key])
|
5436
5520
|
end
|
5437
5521
|
|
5438
5522
|
def test_adds_nested_routing_key_with_dollar_dot
|
@@ -5442,7 +5526,8 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5442
5526
|
driver.run(default_tag: 'test') do
|
5443
5527
|
driver.feed(nested_sample_record)
|
5444
5528
|
end
|
5445
|
-
|
5529
|
+
routing_key = driver.instance.instance_variable_get(:@routing_key_name)
|
5530
|
+
assert_equal('routing', index_cmds[0]['index'][routing_key])
|
5446
5531
|
end
|
5447
5532
|
|
5448
5533
|
def test_adds_nested_routing_key_with_bracket
|
@@ -5452,7 +5537,8 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5452
5537
|
driver.run(default_tag: 'test') do
|
5453
5538
|
driver.feed(nested_sample_record)
|
5454
5539
|
end
|
5455
|
-
|
5540
|
+
routing_key = driver.instance.instance_variable_get(:@routing_key_name)
|
5541
|
+
assert_equal('routing', index_cmds[0]['index'][routing_key])
|
5456
5542
|
end
|
5457
5543
|
end
|
5458
5544
|
|
@@ -5463,7 +5549,8 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5463
5549
|
driver.run(default_tag: 'test') do
|
5464
5550
|
driver.feed(sample_record)
|
5465
5551
|
end
|
5466
|
-
|
5552
|
+
routing_key = driver.instance.instance_variable_get(:@routing_key_name)
|
5553
|
+
assert(!index_cmds[0]['index'].has_key?(routing_key))
|
5467
5554
|
end
|
5468
5555
|
|
5469
5556
|
def test_adds_routing_key_when_not_configured
|
@@ -5472,7 +5559,8 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5472
5559
|
driver.run(default_tag: 'test') do
|
5473
5560
|
driver.feed(sample_record)
|
5474
5561
|
end
|
5475
|
-
|
5562
|
+
routing_key = driver.instance.instance_variable_get(:@routing_key_name)
|
5563
|
+
assert(!index_cmds[0]['index'].has_key?(routing_key))
|
5476
5564
|
end
|
5477
5565
|
|
5478
5566
|
def test_remove_one_key
|
@@ -6157,7 +6245,12 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
6157
6245
|
end
|
6158
6246
|
|
6159
6247
|
def test_ignore_exception
|
6160
|
-
|
6248
|
+
ignore_classes = if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
|
6249
|
+
["Elastic::Transport::Transport::Errors::ServiceUnavailable"]
|
6250
|
+
else
|
6251
|
+
["Elasticsearch::Transport::Transport::Errors::ServiceUnavailable"]
|
6252
|
+
end
|
6253
|
+
driver.configure("ignore_exceptions #{ignore_classes}")
|
6161
6254
|
stub_elastic_unavailable
|
6162
6255
|
stub_elastic_info
|
6163
6256
|
|
@@ -6167,7 +6260,12 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
6167
6260
|
end
|
6168
6261
|
|
6169
6262
|
def test_ignore_exception_with_superclass
|
6170
|
-
|
6263
|
+
ignore_classes = if Gem::Version.new(TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
|
6264
|
+
["Elastic::Transport::Transport::Errors::ServiceUnavailable"]
|
6265
|
+
else
|
6266
|
+
["Elasticsearch::Transport::Transport::Errors::ServiceUnavailable"]
|
6267
|
+
end
|
6268
|
+
driver.configure("ignore_exceptions #{ignore_classes}")
|
6171
6269
|
stub_elastic_unavailable
|
6172
6270
|
stub_elastic_info
|
6173
6271
|
|