logstash-output-elasticsearch 11.22.16-java → 12.0.0-java

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -17
  3. data/README.md +1 -3
  4. data/docs/index.asciidoc +19 -106
  5. data/lib/logstash/outputs/elasticsearch/http_client/manticore_adapter.rb +4 -1
  6. data/lib/logstash/outputs/elasticsearch/http_client/pool.rb +22 -12
  7. data/lib/logstash/outputs/elasticsearch/http_client.rb +31 -44
  8. data/lib/logstash/outputs/elasticsearch/template_manager.rb +1 -16
  9. data/lib/logstash/outputs/elasticsearch.rb +0 -47
  10. data/lib/logstash/plugin_mixins/elasticsearch/api_configs.rb +12 -28
  11. data/lib/logstash/plugin_mixins/elasticsearch/common.rb +1 -11
  12. data/logstash-output-elasticsearch.gemspec +2 -2
  13. data/spec/es_spec_helper.rb +22 -34
  14. data/spec/fixtures/test_certs/GENERATED_AT +1 -1
  15. data/spec/fixtures/test_certs/ca.crt +27 -30
  16. data/spec/fixtures/test_certs/ca.der.sha256 +1 -1
  17. data/spec/fixtures/test_certs/renew.sh +3 -2
  18. data/spec/fixtures/test_certs/test.crt +28 -29
  19. data/spec/fixtures/test_certs/test.der.sha256 +1 -1
  20. data/spec/fixtures/test_certs/test.p12 +0 -0
  21. data/spec/integration/outputs/compressed_indexing_spec.rb +1 -3
  22. data/spec/integration/outputs/delete_spec.rb +4 -4
  23. data/spec/integration/outputs/ilm_spec.rb +12 -18
  24. data/spec/integration/outputs/index_spec.rb +2 -12
  25. data/spec/integration/outputs/index_version_spec.rb +7 -7
  26. data/spec/integration/outputs/metrics_spec.rb +1 -4
  27. data/spec/integration/outputs/painless_update_spec.rb +10 -11
  28. data/spec/integration/outputs/unsupported_actions_spec.rb +10 -15
  29. data/spec/integration/outputs/update_spec.rb +9 -11
  30. data/spec/spec_helper.rb +0 -8
  31. data/spec/support/elasticsearch/api/actions/get_alias.rb +18 -0
  32. data/spec/support/elasticsearch/api/actions/put_alias.rb +24 -0
  33. data/spec/unit/outputs/elasticsearch/http_client_spec.rb +0 -77
  34. data/spec/unit/outputs/elasticsearch/template_manager_spec.rb +0 -71
  35. data/spec/unit/outputs/elasticsearch_spec.rb +3 -86
  36. data/spec/unit/outputs/elasticsearch_ssl_spec.rb +22 -0
  37. data/spec/unit/outputs/error_whitelist_spec.rb +1 -0
  38. metadata +25 -19
  39. data/version +0 -1
@@ -241,6 +241,7 @@ module LogStash; module PluginMixins; module ElasticSearch
241
241
  @dlq_writer.write(event, "#{detailed_message}")
242
242
  else
243
243
  log_level = dig_value(response, 'index', 'error', 'type') == 'invalid_index_name_exception' ? :error : :warn
244
+
244
245
  @logger.public_send(log_level, message, status: status, action: action_params, response: response)
245
246
  end
246
247
  end
@@ -272,7 +273,6 @@ module LogStash; module PluginMixins; module ElasticSearch
272
273
  end
273
274
 
274
275
  actions_to_retry = []
275
- dlq_routed_stats = {}
276
276
  responses.each_with_index do |response,idx|
277
277
  action_type, action_props = response.first
278
278
 
@@ -294,11 +294,6 @@ module LogStash; module PluginMixins; module ElasticSearch
294
294
  elsif @dlq_codes.include?(status)
295
295
  handle_dlq_response("Could not index event to Elasticsearch.", action, status, response)
296
296
  @document_level_metrics.increment(:dlq_routed)
297
- if dlq_routed_stats.key?(status)
298
- dlq_routed_stats[status][:count] += 1
299
- else
300
- dlq_routed_stats[status] = { :count => 1, :sample_event => { :action => action, :response => response } }
301
- end
302
297
  next
303
298
  else
304
299
  # only log what the user whitelisted
@@ -308,11 +303,6 @@ module LogStash; module PluginMixins; module ElasticSearch
308
303
  end
309
304
  end
310
305
 
311
- if @dlq_writer && !dlq_routed_stats.empty?
312
- total = dlq_routed_stats.values.sum { |entry| entry[:count] }
313
- @logger.warn("Events could not be indexed and routing to DLQ", :count => total, :dlq_routed_stats => dlq_routed_stats)
314
- end
315
-
316
306
  actions_to_retry
317
307
  end
318
308
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch'
3
- s.version = ::File.read('version').split("\n").first
3
+ s.version = '12.0.0'
4
4
  s.licenses = ['apache-2.0']
5
5
  s.summary = "Stores logs in Elasticsearch"
6
6
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.platform = RUBY_PLATFORM
13
13
 
14
14
  # Files
15
- s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "version", "docs/**/*"]
15
+ s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
16
16
 
17
17
  # Tests
18
18
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -1,18 +1,15 @@
1
1
  require_relative './spec_helper'
2
2
 
3
3
  require 'elasticsearch'
4
+ require_relative "support/elasticsearch/api/actions/delete_ilm_policy"
5
+ require_relative "support/elasticsearch/api/actions/get_alias"
6
+ require_relative "support/elasticsearch/api/actions/put_alias"
7
+ require_relative "support/elasticsearch/api/actions/get_ilm_policy"
8
+ require_relative "support/elasticsearch/api/actions/put_ilm_policy"
4
9
 
5
10
  require 'json'
6
11
  require 'cabin'
7
12
 
8
- # remove this condition and support package once plugin starts consuming elasticsearch-ruby v8 client
9
- # in elasticsearch-ruby v7, ILM APIs were in a separate xpack gem, now directly available
10
- unless elastic_ruby_v8_client_available?
11
- require_relative "support/elasticsearch/api/actions/delete_ilm_policy"
12
- require_relative "support/elasticsearch/api/actions/get_ilm_policy"
13
- require_relative "support/elasticsearch/api/actions/put_ilm_policy"
14
- end
15
-
16
13
  module ESHelper
17
14
  def get_host_port
18
15
  if ENV["INTEGRATION"] == "true"
@@ -23,12 +20,8 @@ module ESHelper
23
20
  end
24
21
 
25
22
  def get_client
26
- if elastic_ruby_v8_client_available?
27
- Elasticsearch::Client.new(:hosts => [get_host_port])
28
- else
29
- Elasticsearch::Client.new(:hosts => [get_host_port]).tap do |client|
30
- allow(client).to receive(:verify_elasticsearch).and_return(true) # bypass client side version checking
31
- end
23
+ Elasticsearch::Client.new(:hosts => [get_host_port]).tap do |client|
24
+ allow(client).to receive(:verify_elasticsearch).and_return(true) # bypass client side version checking
32
25
  end
33
26
  end
34
27
 
@@ -135,36 +128,31 @@ module ESHelper
135
128
  end
136
129
 
137
130
  def get_policy(client, policy_name)
138
- if elastic_ruby_v8_client_available?
139
- client.index_lifecycle_management.get_lifecycle(policy: policy_name)
140
- else
141
- client.get_ilm_policy(name: policy_name)
142
- end
131
+ client.get_ilm_policy(name: policy_name)
143
132
  end
144
133
 
145
134
  def put_policy(client, policy_name, policy)
146
- if elastic_ruby_v8_client_available?
147
- client.index_lifecycle_management.put_lifecycle({:policy => policy_name, :body=> policy})
148
- else
149
- client.put_ilm_policy({:name => policy_name, :body=> policy})
150
- end
135
+ client.put_ilm_policy({:name => policy_name, :body=> policy})
136
+ end
137
+
138
+ def put_alias(client, the_alias, index)
139
+ body = {
140
+ "aliases" => {
141
+ index => {
142
+ "is_write_index"=> true
143
+ }
144
+ }
145
+ }
146
+ client.put_alias({name: the_alias, body: body})
151
147
  end
152
148
 
153
149
  def clean_ilm(client)
154
- if elastic_ruby_v8_client_available?
155
- client.index_lifecycle_management.get_lifecycle.each_key { |key| client.index_lifecycle_management.delete_lifecycle(policy: key) if key =~ /logstash-policy/ }
156
- else
157
- client.get_ilm_policy.each_key { |key| client.delete_ilm_policy(name: key) if key =~ /logstash-policy/ }
158
- end
150
+ client.get_ilm_policy.each_key { |key| client.delete_ilm_policy(name: key) if key =~ /logstash-policy/ }
159
151
  end
160
152
 
161
153
  def supports_ilm?(client)
162
154
  begin
163
- if elastic_ruby_v8_client_available?
164
- client.index_lifecycle_management.get_lifecycle
165
- else
166
- client.get_ilm_policy
167
- end
155
+ client.get_ilm_policy
168
156
  true
169
157
  rescue
170
158
  false
@@ -1 +1 @@
1
- 2025-07-22T11:15:03+01:00
1
+ 2024-06-25T21:50:58+01:00
@@ -1,32 +1,29 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIFdTCCA12gAwIBAgIUDITbsLT9hKser0ZzBZsxqgaZdWswDQYJKoZIhvcNAQEL
3
- BQAwSjELMAkGA1UEBhMCUFQxCzAJBgNVBAgMAk5BMQ8wDQYDVQQHDAZMaXNib24x
4
- DjAMBgNVBAoMBU15TGFiMQ0wCwYDVQQDDARyb290MB4XDTI1MDcyMjEwMTUwM1oX
5
- DTM1MDcyMDEwMTUwM1owSjELMAkGA1UEBhMCUFQxCzAJBgNVBAgMAk5BMQ8wDQYD
6
- VQQHDAZMaXNib24xDjAMBgNVBAoMBU15TGFiMQ0wCwYDVQQDDARyb290MIICIjAN
7
- BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAy1MyoBa4fXtv1eo9rkvcc2qCdn3n
8
- z6C9w63tD+w4S9wNAmCTNn4bLCHl6vkkXaKiZg4eIPkmdxivhiZFAq5h8PoHVYjk
9
- W5C2EP86UDX9Eeq1tjbsnfdJo7rqujyBqXu+MetcpCR59VhHB187oOqpuFXoviwy
10
- LLwXNDnlMymgzflxa6+gAzG9JCoZnilhgqd81IaHMe+yx81LXG78vBvtWO7iM+Gn
11
- 7jcGQbASKYjmSbuM0LWfCOIe3EOxj+z3cApr+8uS1cpQrmcDeOMk6EBtFNWds4CD
12
- EW3Rhtf3zFb9pSqxyAFRWz0n8zJNEzBUontWya2HU90lCSxQBK7MRKVI+XT10yNN
13
- D4xfMkO3Qm9fxIgk+ZsGeDvwxJoJSGk5mKKLWXaYF89Z6PHbQj9IwJQ2bNvCbbD0
14
- kPnQm/aJfiXiB7g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f535mSwPdk/j/zw4IZTvlmwKW3FyMDhwYL/zX7J0c6MzMP
17
+ LEdi73Qjzmr3ENIrir4O86wNz81YRfYkg9ZX8yKJK9LBAUrYCjJ3AgMBAAEwDQYJ
18
+ KoZIhvcNAQELBQADggIBABym9LMyS9W9lvpcH4OK1YLfBPJwrhZ+4keiriY4zWOo
19
+ pB+v2Q35neMMXSlTDpeIwPdMkqsh8VZprOWURF80JGvpJ6fBfi05rCDWp/ol1ZKi
20
+ snCA+dE2zDK7Z3+F0MbakT5oBi5WgkXSvRvlJEJ/gBD7WC1wq0kxCMK+M5w2RPAT
21
+ nnV/iozNBkwExxyJA7BpS6F/v0XjwK7fm5Kpql7zKlh5piZ2IVU0B60Sqskcb2mU
22
+ 90+1r9T06ekIW/Iz1jd5RWYziu0nbmDeKeKvGAICNU+evYXW+/5kKecMLuEvDCgS
23
+ ssbt/Hb510uLHhxfhN4SbvBl2zADsLC+2arf2ATIwD8ZXDDs04ayBsejV0ZwVrTZ
24
+ ExKqAys+B3tuIHGRqL5VukdmH6g6oJziYueohPBCOuSOzDd0FhppF4uXZS8DReSg
25
+ KieO2ZYfiA1gVRiY6jPx+r7J9I5kSS1gwr/e3zHJHa79ijMB1SSIswQUmgSMkwGh
26
+ sNyDNI9ZxgJan3v7kVargMt2LiNcXvVyTzPSYSXcY7SoebfpMprVIG7vZ9TZf+Uu
27
+ FQeOfxdLFuGTnpFrYmvOD3OIKfODlY5t+TNICg7A3eTUXeJPcdBBnuVCiQU6TCB5
28
+ H+69K5w54Q6a70sHZU1IWsGT8XtbUizPNQky+LAFsE/5oUnCqtypeEu4srcZK53x
32
29
  -----END CERTIFICATE-----
@@ -1 +1 @@
1
- d403930d5296f1515aadd3f730757e7719188b63a276687a3475128b746e4340
1
+ 8b23238088af65cbae6ee9c23821068d896ec1dad081e2a1035ff70866943247
@@ -3,7 +3,8 @@
3
3
  set -e
4
4
  cd "$(dirname "$0")"
5
5
 
6
- openssl req -x509 -new -nodes -key ca.key -subj "/C=PT/ST=NA/L=Lisbon/O=MyLab/CN=root" -sha256 -days 3650 -out ca.crt
6
+ openssl x509 -x509toreq -in ca.crt -signkey ca.key -out ca.csr
7
+ openssl x509 -req -days 365 -in ca.csr -set_serial 0x01 -signkey ca.key -out ca.crt && rm ca.csr
7
8
  openssl x509 -in ca.crt -outform der | sha256sum | awk '{print $1}' > ca.der.sha256
8
9
 
9
10
  openssl x509 -x509toreq -in test.crt -signkey test.key -out test.csr
@@ -12,4 +13,4 @@ openssl x509 -in test.crt -outform der | sha256sum | awk '{print $1}' > test.der
12
13
  openssl pkcs12 -export -inkey test.key -in test.crt -passout "pass:1234567890" -out test.p12
13
14
 
14
15
  # output ISO8601 timestamp to file
15
- date -Iseconds > GENERATED_AT
16
+ date -Iseconds > GENERATED_AT
@@ -1,31 +1,30 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIFWjCCA0KgAwIBAgIBATANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQGEwJQVDEL
3
- MAkGA1UECAwCTkExDzANBgNVBAcMBkxpc2JvbjEOMAwGA1UECgwFTXlMYWIxDTAL
4
- BgNVBAMMBHJvb3QwHhcNMjUwNzIyMTAxNTAzWhcNMjYwNzIyMTAxNTAzWjBTMQsw
5
- CQYDVQQGEwJQVDELMAkGA1UECAwCTkExDzANBgNVBAcMBkxpc2JvbjEOMAwGA1UE
6
- CgwFTXlMYWIxFjAUBgNVBAMMDWVsYXN0aWNzZWFyY2gwggIiMA0GCSqGSIb3DQEB
7
- AQUAA4ICDwAwggIKAoICAQDGIT9szzhN5HvZ2nivnCDzVfdYbbqBhgEbPppWPyFc
8
- V0r2rtmWfeK5EEdsTS/Ey4owTceOplPpAp4svF+a/i1/bHhqnQYYU4f7Qic4fDAs
9
- zLdiSIo0o1csNvIogm/P+uvSzE6eZRZUSmo49dY5SKSJt6Pjh6lM2MHEjsPKIKdA
10
- N57wEN90q4IZv6AHE9rphqxcmF1k+j5xmhCUS1EJ+y7hyZ0S7Hghdg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ytzb+8iSw==
31
30
  -----END CERTIFICATE-----
@@ -1 +1 @@
1
- 386ae6ef809d20ddfcc7ca68f480e82007c031b365c86cc58922cf1bd7238f89
1
+ 80329a197063dea8cf7905d10d221648bbdbc05b8fb1d4c2e384b831bc6590df
Binary file
@@ -36,9 +36,7 @@ end
36
36
  {
37
37
  "Content-Encoding" => "gzip",
38
38
  "Content-Type" => "application/json",
39
- 'x-elastic-product-origin' => 'logstash-output-elasticsearch',
40
- 'X-Elastic-Event-Count' => anything,
41
- 'X-Elastic-Uncompressed-Request-Length' => anything,
39
+ 'x-elastic-product-origin' => 'logstash-output-elasticsearch'
42
40
  }
43
41
  }
44
42
 
@@ -39,12 +39,12 @@ describe "Versioned delete", :integration => true do
39
39
  it "should ignore non-monotonic external version updates" do
40
40
  id = "ev2"
41
41
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "index", "message" => "foo", "my_version" => 99)])
42
- r = es.get(:index => 'logstash-delete', :id => id, :refresh => true)
42
+ r = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
43
43
  expect(r['_version']).to eq(99)
44
44
  expect(r['_source']['message']).to eq('foo')
45
45
 
46
46
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "delete", "message" => "foo", "my_version" => 98)])
47
- r2 = es.get(:index => 'logstash-delete', :id => id, :refresh => true)
47
+ r2 = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
48
48
  expect(r2['_version']).to eq(99)
49
49
  expect(r2['_source']['message']).to eq('foo')
50
50
  end
@@ -52,12 +52,12 @@ describe "Versioned delete", :integration => true do
52
52
  it "should commit monotonic external version updates" do
53
53
  id = "ev3"
54
54
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "index", "message" => "foo", "my_version" => 99)])
55
- r = es.get(:index => 'logstash-delete', :id => id, :refresh => true)
55
+ r = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
56
56
  expect(r['_version']).to eq(99)
57
57
  expect(r['_source']['message']).to eq('foo')
58
58
 
59
59
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "delete", "message" => "foo", "my_version" => 100)])
60
- expect { es.get(:index => 'logstash-delete', :id => id, :refresh => true) }.to raise_error(get_expected_error_class)
60
+ expect { es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true) }.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
61
61
  end
62
62
  end
63
63
  end
@@ -102,7 +102,7 @@ shared_examples_for 'an ILM disabled Logstash' do
102
102
  it 'should not install the default policy' do
103
103
  subject.register
104
104
  sleep(1)
105
- expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(get_expected_error_class)
105
+ expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
106
106
  end
107
107
 
108
108
  it 'should not write the ILM settings into the template' do
@@ -282,12 +282,12 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
282
282
  subject.register
283
283
  sleep(1)
284
284
  expect(@es.indices.exists_alias(name: "logstash")).to be_truthy
285
- expect(@es.indices.get_alias(name: "logstash")).to include("logstash-000001")
285
+ expect(@es.get_alias(name: "logstash")).to include("logstash-000001")
286
286
  end
287
287
  end
288
288
 
289
289
  it 'should install it if it is not present' do
290
- expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(get_expected_error_class)
290
+ expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
291
291
  subject.register
292
292
  sleep(1)
293
293
  expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.not_to raise_error
@@ -298,7 +298,7 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
298
298
  subject.register
299
299
  sleep(1)
300
300
  expect(@es.indices.exists_alias(name: "logstash")).to be_truthy
301
- expect(@es.indices.get_alias(name: "logstash")).to include("logstash-#{todays_date}-000001")
301
+ expect(@es.get_alias(name: "logstash")).to include("logstash-#{todays_date}-000001")
302
302
  end
303
303
 
304
304
  it 'should ingest into a single index' do
@@ -340,14 +340,14 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
340
340
  let (:policy) { small_max_doc_policy }
341
341
 
342
342
  before do
343
- expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(get_expected_error_class)
343
+ expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
344
344
  put_policy(@es,ilm_policy_name, policy)
345
345
  end
346
346
 
347
347
  it 'should not install the default policy if it is not used' do
348
348
  subject.register
349
349
  sleep(1)
350
- expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(get_expected_error_class)
350
+ expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
351
351
  end
352
352
  end
353
353
 
@@ -357,14 +357,14 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
357
357
  let (:policy) { max_age_policy("1d") }
358
358
 
359
359
  before do
360
- expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(get_expected_error_class)
360
+ expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
361
361
  put_policy(@es,ilm_policy_name, policy)
362
362
  end
363
363
 
364
364
  it 'should not install the default policy if it is not used' do
365
365
  subject.register
366
366
  sleep(1)
367
- expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(get_expected_error_class)
367
+ expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
368
368
  end
369
369
  end
370
370
 
@@ -374,7 +374,7 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
374
374
  subject.register
375
375
  sleep(1)
376
376
  expect(@es.indices.exists_alias(name: expected_index)).to be_truthy
377
- expect(@es.indices.get_alias(name: expected_index)).to include("#{expected_index}-#{todays_date}-000001")
377
+ expect(@es.get_alias(name: expected_index)).to include("#{expected_index}-#{todays_date}-000001")
378
378
  end
379
379
 
380
380
  it 'should write the ILM settings into the template' do
@@ -443,18 +443,17 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
443
443
  subject.register
444
444
  sleep(1)
445
445
  expect(@es.indices.exists_alias(name: ilm_rollover_alias)).to be_truthy
446
- expect(@es.indices.get_alias(name: ilm_rollover_alias)).to include("#{ilm_rollover_alias}-#{todays_date}-000001")
446
+ expect(@es.get_alias(name: ilm_rollover_alias)).to include("#{ilm_rollover_alias}-#{todays_date}-000001")
447
447
  end
448
448
 
449
449
  context 'when the custom rollover alias already exists' do
450
450
  it 'should ignore the already exists error' do
451
451
  expect(@es.indices.exists_alias(name: ilm_rollover_alias)).to be_falsey
452
- @es.indices.create(index: "#{ilm_rollover_alias}-#{todays_date}-000001")
453
- @es.indices.put_alias(name: ilm_rollover_alias, index: "#{ilm_rollover_alias}-#{todays_date}-000001")
452
+ put_alias(@es, "#{ilm_rollover_alias}-#{todays_date}-000001", ilm_rollover_alias)
454
453
  expect(@es.indices.exists_alias(name: ilm_rollover_alias)).to be_truthy
455
454
  subject.register
456
455
  sleep(1)
457
- expect(@es.indices.get_alias(name: ilm_rollover_alias)).to include("#{ilm_rollover_alias}-#{todays_date}-000001")
456
+ expect(@es.get_alias(name: ilm_rollover_alias)).to include("#{ilm_rollover_alias}-#{todays_date}-000001")
458
457
  end
459
458
 
460
459
  end
@@ -533,8 +532,3 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
533
532
  end
534
533
 
535
534
  end
536
-
537
- def get_expected_error_class
538
- return Elastic::Transport::Transport::Errors::NotFound if elastic_ruby_v8_client_available?
539
- Elasticsearch::Transport::Transport::Errors::NotFound
540
- end
@@ -215,22 +215,12 @@ describe "indexing" do
215
215
 
216
216
  it "sets the correct content-type header" do
217
217
  expected_manticore_opts = {
218
- :headers => {
219
- "Content-Type" => "application/json",
220
- 'x-elastic-product-origin' => 'logstash-output-elasticsearch',
221
- 'X-Elastic-Event-Count' => anything,
222
- 'X-Elastic-Uncompressed-Request-Length' => anything
223
- },
218
+ :headers => {"Content-Type" => "application/json", 'x-elastic-product-origin' => 'logstash-output-elasticsearch'},
224
219
  :body => anything
225
220
  }
226
221
  if secure
227
222
  expected_manticore_opts = {
228
- :headers => {
229
- "Content-Type" => "application/json",
230
- 'x-elastic-product-origin' => 'logstash-output-elasticsearch',
231
- 'X-Elastic-Event-Count' => anything,
232
- 'X-Elastic-Uncompressed-Request-Length' => anything
233
- },
223
+ :headers => {"Content-Type" => "application/json", 'x-elastic-product-origin' => 'logstash-output-elasticsearch'},
234
224
  :body => anything,
235
225
  :auth => {
236
226
  :user => user,
@@ -36,11 +36,11 @@ describe "Versioned indexing", :integration => true do
36
36
 
37
37
  it "should default to ES version" do
38
38
  subject.multi_receive([LogStash::Event.new("my_id" => "123", "message" => "foo")])
39
- r = es.get(:index => 'logstash-index', :id => '123', :refresh => true)
39
+ r = es.get(:index => 'logstash-index', :type => doc_type, :id => "123", :refresh => true)
40
40
  expect(r["_version"]).to eq(1)
41
41
  expect(r["_source"]["message"]).to eq('foo')
42
42
  subject.multi_receive([LogStash::Event.new("my_id" => "123", "message" => "foobar")])
43
- r2 = es.get(:index => 'logstash-index', :id => '123', :refresh => true)
43
+ r2 = es.get(:index => 'logstash-index', :type => doc_type, :id => "123", :refresh => true)
44
44
  expect(r2["_version"]).to eq(2)
45
45
  expect(r2["_source"]["message"]).to eq('foobar')
46
46
  end
@@ -63,7 +63,7 @@ describe "Versioned indexing", :integration => true do
63
63
  it "should respect the external version" do
64
64
  id = "ev1"
65
65
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "99", "message" => "foo")])
66
- r = es.get(:index => 'logstash-index', :id => id, :refresh => true)
66
+ r = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
67
67
  expect(r["_version"]).to eq(99)
68
68
  expect(r["_source"]["message"]).to eq('foo')
69
69
  end
@@ -71,12 +71,12 @@ describe "Versioned indexing", :integration => true do
71
71
  it "should ignore non-monotonic external version updates" do
72
72
  id = "ev2"
73
73
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "99", "message" => "foo")])
74
- r = es.get(:index => 'logstash-index', :id => id, :refresh => true)
74
+ r = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
75
75
  expect(r["_version"]).to eq(99)
76
76
  expect(r["_source"]["message"]).to eq('foo')
77
77
 
78
78
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "98", "message" => "foo")])
79
- r2 = es.get(:index => 'logstash-index', :id => id, :refresh => true)
79
+ r2 = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
80
80
  expect(r2["_version"]).to eq(99)
81
81
  expect(r2["_source"]["message"]).to eq('foo')
82
82
  end
@@ -84,12 +84,12 @@ describe "Versioned indexing", :integration => true do
84
84
  it "should commit monotonic external version updates" do
85
85
  id = "ev3"
86
86
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "99", "message" => "foo")])
87
- r = es.get(:index => 'logstash-index', :id => id, :refresh => true)
87
+ r = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
88
88
  expect(r["_version"]).to eq(99)
89
89
  expect(r["_source"]["message"]).to eq('foo')
90
90
 
91
91
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "100", "message" => "foo")])
92
- r2 = es.get(:index => 'logstash-index', :id => id, :refresh => true)
92
+ r2 = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
93
93
  expect(r2["_version"]).to eq(100)
94
94
  expect(r2["_source"]["message"]).to eq('foo')
95
95
  end
@@ -5,10 +5,7 @@ describe "metrics", :integration => true do
5
5
  require "logstash/outputs/elasticsearch"
6
6
  settings = {
7
7
  "manage_template" => false,
8
- "hosts" => "#{get_host_port()}",
9
- # write data to a random non templated index to ensure the bulk partially fails
10
- # don't use streams like "logs-*" as those have failure stores enabled, causing the bulk to succeed instead
11
- "index" => "custom_index_#{rand(10000)}"
8
+ "hosts" => "#{get_host_port()}"
12
9
  }
13
10
  plugin = LogStash::Outputs::ElasticSearch.new(settings)
14
11
  end
@@ -22,12 +22,11 @@ describe "Update actions using painless scripts", :integration => true, :update_
22
22
  # This can fail if there are no indexes, ignore failure.
23
23
  @es.indices.delete(:index => "*") rescue nil
24
24
  @es.index(
25
- {
26
- :index => 'logstash-update',
27
- :id => '123',
28
- :body => { :message => 'Test', :counter => 1 },
29
- :refresh => true
30
- })
25
+ :index => 'logstash-update',
26
+ :type => doc_type,
27
+ :id => "123",
28
+ :body => { :message => 'Test', :counter => 1 }
29
+ )
31
30
  @es.indices.refresh
32
31
  end
33
32
 
@@ -47,7 +46,7 @@ describe "Update actions using painless scripts", :integration => true, :update_
47
46
  subject = get_es_output(plugin_parameters)
48
47
  subject.register
49
48
  subject.multi_receive([LogStash::Event.new("count" => 4 )])
50
- r = @es.get(:index => 'logstash-update', :id => "123", :refresh => true)
49
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
51
50
  expect(r["_source"]["counter"]).to eq(5)
52
51
  end
53
52
  end
@@ -58,7 +57,7 @@ describe "Update actions using painless scripts", :integration => true, :update_
58
57
  subject = get_es_output({ 'document_id' => "456", 'upsert' => '{"message": "upsert message"}' })
59
58
  subject.register
60
59
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
61
- r = @es.get(:index => 'logstash-update', :id => "456", :refresh => true)
60
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
62
61
  expect(r["_source"]["message"]).to eq('upsert message')
63
62
  end
64
63
 
@@ -66,7 +65,7 @@ describe "Update actions using painless scripts", :integration => true, :update_
66
65
  subject = get_es_output({ 'document_id' => "456", 'doc_as_upsert' => true })
67
66
  subject.register
68
67
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
69
- r = @es.get(:index => 'logstash-update', :id => "456", :refresh => true)
68
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
70
69
  expect(r["_source"]["message"]).to eq('sample message here')
71
70
  end
72
71
 
@@ -83,7 +82,7 @@ describe "Update actions using painless scripts", :integration => true, :update_
83
82
  subject.register
84
83
 
85
84
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
86
- r = @es.get(:index => 'logstash-update', :id => "456", :refresh => true)
85
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
87
86
  expect(r["_source"]["message"]).to eq('upsert message')
88
87
  end
89
88
 
@@ -92,7 +91,7 @@ describe "Update actions using painless scripts", :integration => true, :update_
92
91
  subject.register
93
92
  subject.multi_receive([LogStash::Event.new("counter" => 1)])
94
93
  @es.indices.refresh
95
- r = @es.get(:index => 'logstash-update', :id => "456", :refresh => true)
94
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
96
95
  expect(r["_source"]["counter"]).to eq(1)
97
96
  end
98
97
  end