logstash-output-elasticsearch 10.6.2-java → 10.8.2-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/CONTRIBUTORS +1 -0
  4. data/README.md +1 -1
  5. data/docs/index.asciidoc +224 -152
  6. data/lib/logstash/outputs/elasticsearch.rb +300 -165
  7. data/lib/logstash/outputs/elasticsearch/http_client.rb +7 -2
  8. data/lib/logstash/outputs/elasticsearch/http_client/pool.rb +13 -28
  9. data/lib/logstash/outputs/elasticsearch/http_client_builder.rb +1 -0
  10. data/lib/logstash/outputs/elasticsearch/ilm.rb +9 -5
  11. data/lib/logstash/outputs/elasticsearch/license_checker.rb +47 -0
  12. data/lib/logstash/outputs/elasticsearch/template_manager.rb +8 -3
  13. data/lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-8x.json +39 -33
  14. data/lib/logstash/plugin_mixins/elasticsearch/api_configs.rb +163 -0
  15. data/lib/logstash/{outputs → plugin_mixins}/elasticsearch/common.rb +40 -161
  16. data/lib/logstash/plugin_mixins/elasticsearch/noop_license_checker.rb +9 -0
  17. data/logstash-output-elasticsearch.gemspec +1 -1
  18. data/spec/es_spec_helper.rb +32 -12
  19. data/spec/fixtures/template-with-policy-es8x.json +50 -0
  20. data/spec/integration/outputs/ilm_spec.rb +34 -20
  21. data/spec/integration/outputs/metrics_spec.rb +1 -5
  22. data/spec/unit/outputs/elasticsearch/http_client/pool_spec.rb +45 -5
  23. data/spec/unit/outputs/elasticsearch/http_client_spec.rb +22 -0
  24. data/spec/unit/outputs/elasticsearch/template_manager_spec.rb +31 -0
  25. data/spec/unit/outputs/elasticsearch_spec.rb +22 -0
  26. data/spec/unit/outputs/license_check_spec.rb +41 -0
  27. metadata +10 -4
  28. data/lib/logstash/outputs/elasticsearch/common_configs.rb +0 -167
@@ -1,7 +1,10 @@
1
1
  require "logstash/outputs/elasticsearch/template_manager"
2
2
 
3
- module LogStash; module Outputs; class ElasticSearch;
3
+ module LogStash; module PluginMixins; module ElasticSearch
4
4
  module Common
5
+
6
+ # This module defines common methods that can be reused by alternate elasticsearch output plugins such as the elasticsearch_data_streams output.
7
+
5
8
  attr_reader :client, :hosts
6
9
 
7
10
  # These codes apply to documents, not at the request level
@@ -9,110 +12,26 @@ module LogStash; module Outputs; class ElasticSearch;
9
12
  DOC_SUCCESS_CODES = [200, 201]
10
13
  DOC_CONFLICT_CODE = 409
11
14
 
12
- # When you use external versioning, you are communicating that you want
13
- # to ignore conflicts. More obviously, since an external version is a
14
- # constant part of the incoming document, we should not retry, as retrying
15
- # will never succeed.
16
- VERSION_TYPES_PERMITTING_CONFLICT = ["external", "external_gt", "external_gte"]
17
-
18
- def register
19
- @template_installed = Concurrent::AtomicBoolean.new(false)
20
- @stopping = Concurrent::AtomicBoolean.new(false)
21
- # To support BWC, we check if DLQ exists in core (< 5.4). If it doesn't, we use nil to resort to previous behavior.
22
- @dlq_writer = dlq_enabled? ? execution_context.dlq_writer : nil
23
- build_client
24
- setup_after_successful_connection
25
- check_action_validity
26
- @bulk_request_metrics = metric.namespace(:bulk_requests)
27
- @document_level_metrics = metric.namespace(:documents)
28
- @logger.info("New Elasticsearch output", :class => self.class.name, :hosts => @hosts.map(&:sanitized).map(&:to_s))
29
- end
30
-
31
- # Receive an array of events and immediately attempt to index them (no buffering)
32
- def multi_receive(events)
33
- until @template_installed.true?
34
- sleep 1
35
- end
36
- retrying_submit(events.map {|e| event_action_tuple(e)})
37
- end
38
-
39
- def setup_after_successful_connection
40
- @template_installer ||= Thread.new do
41
- sleep_interval = @retry_initial_interval
42
- until successful_connection? || @stopping.true?
43
- @logger.debug("Waiting for connectivity to Elasticsearch cluster. Retrying in #{sleep_interval}s")
44
- Stud.stoppable_sleep(sleep_interval) { @stopping.true? }
45
- sleep_interval = next_sleep_interval(sleep_interval)
46
- end
47
- if successful_connection?
48
- discover_cluster_uuid
49
- install_template
50
- setup_ilm if ilm_in_use?
51
- end
52
- end
53
- end
54
-
55
- def stop_template_installer
56
- @template_installer.join unless @template_installer.nil?
57
- end
58
-
59
- def successful_connection?
60
- !!maximum_seen_major_version
61
- end
62
-
63
- ##
64
- # WARNING: This method is overridden in a subclass in Logstash Core 7.7-7.8's monitoring,
65
- # where a `client` argument is both required and ignored. In later versions of
66
- # Logstash Core it is optional and ignored, but to make it optional here would
67
- # allow us to accidentally break compatibility with Logstashes where it was required.
68
- # @param noop_required_client [nil]: required `nil` for legacy reasons.
69
- # @return [Boolean]
70
- def use_event_type?(noop_required_client)
71
- maximum_seen_major_version < 8
72
- end
73
-
74
- # Convert the event into a 3-tuple of action, params, and event
75
- def event_action_tuple(event)
76
- action = event.sprintf(@action)
77
-
78
- params = {
79
- :_id => @document_id ? event.sprintf(@document_id) : nil,
80
- :_index => event.sprintf(@index),
81
- routing_field_name => @routing ? event.sprintf(@routing) : nil
82
- }
83
-
84
- params[:_type] = get_event_type(event) if use_event_type?(nil)
85
-
86
- if @pipeline
87
- params[:pipeline] = event.sprintf(@pipeline)
88
- end
89
-
90
- if @parent
91
- if @join_field
92
- join_value = event.get(@join_field)
93
- parent_value = event.sprintf(@parent)
94
- event.set(@join_field, { "name" => join_value, "parent" => parent_value })
95
- params[routing_field_name] = event.sprintf(@parent)
96
- else
97
- params[:parent] = event.sprintf(@parent)
98
- end
99
- end
100
-
101
- if action == 'update'
102
- params[:_upsert] = LogStash::Json.load(event.sprintf(@upsert)) if @upsert != ""
103
- params[:_script] = event.sprintf(@script) if @script != ""
104
- params[retry_on_conflict_action_name] = @retry_on_conflict
105
- end
106
-
107
- if @version
108
- params[:version] = event.sprintf(@version)
109
- end
110
-
111
- if @version_type
112
- params[:version_type] = event.sprintf(@version_type)
15
+ # Perform some ES options validations and Build the HttpClient.
16
+ # Note that this methods may sets the @user, @password, @hosts and @client ivars as a side effect.
17
+ # @param license_checker [#appropriate_license?] An optional license checker that will be used by the Pool class.
18
+ # @return [HttpClient] the new http client
19
+ def build_client(license_checker = nil)
20
+ params["license_checker"] = license_checker
21
+
22
+ # the following 3 options validation & setup methods are called inside build_client
23
+ # because they must be executed prior to building the client and logstash
24
+ # monitoring and management rely on directly calling build_client
25
+ # see https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/934#pullrequestreview-396203307
26
+ validate_authentication
27
+ fill_hosts_from_cloud_id
28
+ setup_hosts
29
+
30
+ params["metric"] = metric
31
+ if @proxy.eql?('')
32
+ @logger.warn "Supplied proxy setting (proxy => '') has no effect"
113
33
  end
114
-
115
- [action, params, event]
34
+ @client ||= ::LogStash::Outputs::ElasticSearch::HttpClientBuilder.build(@logger, @hosts, params)
116
35
  end
117
36
 
118
37
  def validate_authentication
@@ -147,7 +66,7 @@ module LogStash; module Outputs; class ElasticSearch;
147
66
 
148
67
  def hosts_default?(hosts)
149
68
  # NOTE: would be nice if pipeline allowed us a clean way to detect a config default :
150
- hosts.is_a?(Array) && hosts.size == 1 && hosts.first.equal?(CommonConfigs::DEFAULT_HOST)
69
+ hosts.is_a?(Array) && hosts.size == 1 && hosts.first.equal?(LogStash::PluginMixins::ElasticSearch::APIConfigs::DEFAULT_HOST)
151
70
  end
152
71
  private :hosts_default?
153
72
 
@@ -200,17 +119,23 @@ module LogStash; module Outputs; class ElasticSearch;
200
119
  client.maximum_seen_major_version
201
120
  end
202
121
 
203
- def routing_field_name
204
- maximum_seen_major_version >= 6 ? :routing : :_routing
205
- end
206
-
207
- def retry_on_conflict_action_name
208
- maximum_seen_major_version >= 7 ? :retry_on_conflict : :_retry_on_conflict
122
+ def successful_connection?
123
+ !!maximum_seen_major_version
209
124
  end
210
125
 
211
- def install_template
212
- TemplateManager.install_template(self)
213
- @template_installed.make_true
126
+ # launch a thread that waits for an initial successful connection to the ES cluster to call the given block
127
+ # @param block [Proc] the block to execute upon initial successful connection
128
+ # @return [Thread] the successful connection wait thread
129
+ def setup_after_successful_connection(&block)
130
+ Thread.new do
131
+ sleep_interval = @retry_initial_interval
132
+ until successful_connection? || @stopping.true?
133
+ @logger.debug("Waiting for connectivity to Elasticsearch cluster. Retrying in #{sleep_interval}s")
134
+ Stud.stoppable_sleep(sleep_interval) { @stopping.true? }
135
+ sleep_interval = next_sleep_interval(sleep_interval)
136
+ end
137
+ block.call if successful_connection?
138
+ end
214
139
  end
215
140
 
216
141
  def discover_cluster_uuid
@@ -222,22 +147,6 @@ module LogStash; module Outputs; class ElasticSearch;
222
147
  # @logger.error("Unable to retrieve elasticsearch cluster uuid", error => e.message)
223
148
  end
224
149
 
225
- def check_action_validity
226
- raise LogStash::ConfigurationError, "No action specified!" unless @action
227
-
228
- # If we're using string interpolation, we're good!
229
- return if @action =~ /%{.+}/
230
- return if valid_actions.include?(@action)
231
-
232
- raise LogStash::ConfigurationError, "Action '#{@action}' is invalid! Pick one of #{valid_actions} or use a sprintf style statement"
233
- end
234
-
235
- # To be overidden by the -java version
236
- VALID_HTTP_ACTIONS=["index", "delete", "create", "update"]
237
- def valid_actions
238
- VALID_HTTP_ACTIONS
239
- end
240
-
241
150
  def retrying_submit(actions)
242
151
  # Initially we submit the full list of actions
243
152
  submit_actions = actions
@@ -346,32 +255,6 @@ module LogStash; module Outputs; class ElasticSearch;
346
255
  end
347
256
  end
348
257
 
349
- # Determine the correct value for the 'type' field for the given event
350
- DEFAULT_EVENT_TYPE_ES6="doc".freeze
351
- DEFAULT_EVENT_TYPE_ES7="_doc".freeze
352
- def get_event_type(event)
353
- # Set the 'type' value for the index.
354
- type = if @document_type
355
- event.sprintf(@document_type)
356
- else
357
- if maximum_seen_major_version < 6
358
- event.get("type") || DEFAULT_EVENT_TYPE_ES6
359
- elsif maximum_seen_major_version == 6
360
- DEFAULT_EVENT_TYPE_ES6
361
- elsif maximum_seen_major_version == 7
362
- DEFAULT_EVENT_TYPE_ES7
363
- else
364
- nil
365
- end
366
- end
367
-
368
- if !(type.is_a?(String) || type.is_a?(Numeric))
369
- @logger.warn("Bad event type! Non-string/integer type value set!", :type_class => type.class, :type_value => type.to_s, :event => event)
370
- end
371
-
372
- type.to_s
373
- end
374
-
375
258
  # Rescue retryable errors during bulk submission
376
259
  def safe_bulk(actions)
377
260
  sleep_interval = @retry_initial_interval
@@ -442,10 +325,6 @@ module LogStash; module Outputs; class ElasticSearch;
442
325
  end
443
326
  end
444
327
 
445
- def default_index?(index)
446
- @index == @default_index
447
- end
448
-
449
328
  def dlq_enabled?
450
329
  # TODO there should be a better way to query if DLQ is enabled
451
330
  # See more in: https://github.com/elastic/logstash/issues/8064
@@ -453,4 +332,4 @@ module LogStash; module Outputs; class ElasticSearch;
453
332
  !execution_context.dlq_writer.inner_writer.is_a?(::LogStash::Util::DummyDeadLetterQueueWriter)
454
333
  end
455
334
  end
456
- end end end
335
+ end; end; end
@@ -0,0 +1,9 @@
1
+ module LogStash; module PluginMixins; module ElasticSearch
2
+ class NoopLicenseChecker
3
+ INSTANCE = self.new
4
+
5
+ def appropriate_license?(pool, url)
6
+ true
7
+ end
8
+ end
9
+ end; end; end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch'
3
- s.version = '10.6.2'
3
+ s.version = '10.8.2'
4
4
 
5
5
  s.licenses = ['apache-2.0']
6
6
  s.summary = "Stores logs in Elasticsearch"
@@ -49,19 +49,10 @@ module ESHelper
49
49
  Time.now.strftime("%Y.%m.%d")
50
50
  end
51
51
 
52
-
53
- def default_mapping_from_mappings(mappings)
54
- if ESHelper.es_version_satisfies?(">=7")
55
- mappings
56
- else
57
- mappings["_default_"]
58
- end
59
- end
60
-
61
52
  def field_properties_from_template(template_name, field)
62
- mappings = @es.indices.get_template(name: template_name)[template_name]["mappings"]
63
- mapping = default_mapping_from_mappings(mappings)
64
- mapping["properties"][field]["properties"]
53
+ template = get_template(@es, template_name)
54
+ mappings = get_template_mappings(template)
55
+ mappings["properties"][field]["properties"]
65
56
  end
66
57
 
67
58
  def routing_field_name
@@ -105,6 +96,7 @@ module ESHelper
105
96
 
106
97
  def clean(client)
107
98
  client.indices.delete_template(:name => "*")
99
+ client.indices.delete_index_template(:name => "logstash*") rescue nil
108
100
  # This can fail if there are no indexes, ignore failure.
109
101
  client.indices.delete(:index => "*") rescue nil
110
102
  clean_ilm(client) if supports_ilm?(client)
@@ -182,6 +174,34 @@ module ESHelper
182
174
  }
183
175
  }
184
176
  end
177
+
178
+ def get_template(client, name)
179
+ if ESHelper.es_version_satisfies?(">=8")
180
+ t = client.indices.get_index_template(name: name)
181
+ t['index_templates'][0]['index_template']
182
+ else
183
+ t = client.indices.get_template(name: name)
184
+ t[name]
185
+ end
186
+ end
187
+
188
+ def get_template_settings(template)
189
+ if ESHelper.es_version_satisfies?(">=8")
190
+ template['template']['settings']
191
+ else
192
+ template['settings']
193
+ end
194
+ end
195
+
196
+ def get_template_mappings(template)
197
+ if ESHelper.es_version_satisfies?(">=8")
198
+ template['template']['mappings']
199
+ elsif ESHelper.es_version_satisfies?(">=7")
200
+ template['mappings']
201
+ else
202
+ template['mappings']["_default_"]
203
+ end
204
+ end
185
205
  end
186
206
 
187
207
  RSpec.configure do |config|
@@ -0,0 +1,50 @@
1
+ {
2
+ "index_patterns" : "overwrite-*",
3
+ "version" : 80001,
4
+ "template" : {
5
+ "settings" : {
6
+ "index.refresh_interval" : "1s",
7
+ "number_of_shards": 1
8
+ },
9
+ "mappings" : {
10
+ "dynamic_templates" : [ {
11
+ "message_field" : {
12
+ "path_match" : "message",
13
+ "match_mapping_type" : "string",
14
+ "mapping" : {
15
+ "type" : "text",
16
+ "norms" : false
17
+ }
18
+ }
19
+ }, {
20
+ "string_fields" : {
21
+ "match" : "*",
22
+ "match_mapping_type" : "string",
23
+ "mapping" : {
24
+ "type" : "text", "norms" : false,
25
+ "fields" : {
26
+ "keyword" : { "type": "keyword", "ignore_above": 256 }
27
+ }
28
+ }
29
+ }
30
+ } ],
31
+ "properties" : {
32
+ "@timestamp": { "type": "date" },
33
+ "@version": { "type": "keyword" },
34
+ "geoip" : {
35
+ "dynamic": true,
36
+ "properties" : {
37
+ "ip": { "type": "ip" },
38
+ "location" : { "type" : "geo_point" },
39
+ "latitude" : { "type" : "half_float" },
40
+ "longitude" : { "type" : "half_float" }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ },
46
+ "priority": 200,
47
+ "_meta" : {
48
+ "description": "index template for logstash-output-elasticsearch"
49
+ }
50
+ }
@@ -8,7 +8,7 @@ shared_examples_for 'an ILM enabled Logstash' do
8
8
  let (:settings) { super.merge("ilm_policy" => ilm_policy_name)}
9
9
 
10
10
  it 'should rollover when the policy max docs is reached' do
11
- put_policy(@es,ilm_policy_name, policy)
11
+ put_policy(@es, ilm_policy_name, policy)
12
12
  subject.register
13
13
 
14
14
  subject.multi_receive([
@@ -108,9 +108,11 @@ shared_examples_for 'an ILM disabled Logstash' do
108
108
  it 'should not write the ILM settings into the template' do
109
109
  subject.register
110
110
  sleep(1)
111
- expect(@es.indices.get_template(name: "logstash")["logstash"]).to have_index_pattern("logstash-*")
111
+
112
+ template = get_template(@es, "logstash")
113
+ expect(template).to have_index_pattern("logstash-*")
112
114
  if ESHelper.es_version_satisfies?(">= 2")
113
- expect(@es.indices.get_template(name: "logstash")["logstash"]["settings"]['index']['lifecycle']).to be_nil
115
+ expect(get_template_settings(template)['index']['lifecycle']).to be_nil
114
116
  end
115
117
  end
116
118
 
@@ -152,16 +154,17 @@ shared_examples_for 'an ILM disabled Logstash' do
152
154
  end
153
155
 
154
156
  context 'with a custom template name' do
155
- let (:template_name) { "custom_template_name" }
157
+ let (:template_name) { "logstash_custom_template_name" }
156
158
  let (:settings) { super.merge('template_name' => template_name)}
157
159
 
158
160
  it 'should not write the ILM settings into the template' do
159
161
  subject.register
160
162
  sleep(1)
161
163
 
162
- expect(@es.indices.get_template(name: template_name)[template_name]).to have_index_pattern("logstash-*")
164
+ template = get_template(@es, template_name)
165
+ expect(template).to have_index_pattern("logstash-*")
163
166
  if ESHelper.es_version_satisfies?(">= 2")
164
- expect(@es.indices.get_template(name: template_name)[template_name]["settings"]['index']['lifecycle']).to be_nil
167
+ expect(get_template_settings(template)['index']['lifecycle']).to be_nil
165
168
  end
166
169
  end
167
170
  end
@@ -387,16 +390,20 @@ if ESHelper.es_version_satisfies?(">= 6.6")
387
390
  it 'should write the ILM settings into the template' do
388
391
  subject.register
389
392
  sleep(1)
390
- expect(@es.indices.get_template(name: "logstash")["logstash"]).to have_index_pattern("logstash-*")
391
- expect(@es.indices.get_template(name: "logstash")["logstash"]["settings"]['index']['lifecycle']['name']).to eq("logstash-policy")
392
- expect(@es.indices.get_template(name: "logstash")["logstash"]["settings"]['index']['lifecycle']['rollover_alias']).to eq("logstash")
393
+
394
+ template = get_template(@es, "logstash")
395
+ expect(template).to have_index_pattern("logstash-*")
396
+ expect(get_template_settings(template)['index']['lifecycle']['name']).to eq("logstash-policy")
397
+ expect(get_template_settings(template)['index']['lifecycle']['rollover_alias']).to eq("logstash")
393
398
  end
394
399
 
395
400
  it_behaves_like 'an ILM enabled Logstash'
396
401
  end
397
402
 
398
403
  context 'with a set index and a custom index pattern' do
399
- if ESHelper.es_version_satisfies?(">= 7.0")
404
+ if ESHelper.es_version_satisfies?(">= 8.0")
405
+ let (:template) { "spec/fixtures/template-with-policy-es8x.json" }
406
+ elsif ESHelper.es_version_satisfies?(">= 7.0")
400
407
  let (:template) { "spec/fixtures/template-with-policy-es7x.json" }
401
408
  else
402
409
  let (:template) { "spec/fixtures/template-with-policy-es6x.json" }
@@ -408,13 +415,15 @@ if ESHelper.es_version_satisfies?(">= 6.6")
408
415
  it 'should not overwrite the index patterns' do
409
416
  subject.register
410
417
  sleep(1)
411
- expect(@es.indices.get_template(name: "logstash")["logstash"]).to have_index_pattern("overwrite-*")
418
+
419
+ template = get_template(@es, "logstash")
420
+ expect(template).to have_index_pattern("overwrite-*")
412
421
  end
413
422
  end
414
423
 
415
424
 
416
425
  context 'with a custom template' do
417
- let (:ilm_rollover_alias) { "the_cat_in_the_hat" }
426
+ let (:ilm_rollover_alias) { "logstash_the_cat_in_the_hat" }
418
427
  let (:index) { ilm_rollover_alias }
419
428
  let(:expected_index) { index }
420
429
  let (:settings) { super.merge("ilm_policy" => ilm_policy_name,
@@ -422,7 +431,9 @@ if ESHelper.es_version_satisfies?(">= 6.6")
422
431
  "ilm_rollover_alias" => ilm_rollover_alias)}
423
432
 
424
433
 
425
- if ESHelper.es_version_satisfies?(">= 7.0")
434
+ if ESHelper.es_version_satisfies?(">= 8.0")
435
+ let (:template) { "spec/fixtures/template-with-policy-es8x.json" }
436
+ elsif ESHelper.es_version_satisfies?(">= 7.0")
426
437
  let (:template) { "spec/fixtures/template-with-policy-es7x.json" }
427
438
  else
428
439
  let (:template) { "spec/fixtures/template-with-policy-es6x.json" }
@@ -460,13 +471,15 @@ if ESHelper.es_version_satisfies?(">= 6.6")
460
471
  it 'should write the ILM settings into the template' do
461
472
  subject.register
462
473
  sleep(1)
463
- expect(@es.indices.get_template(name: ilm_rollover_alias)[ilm_rollover_alias]).to have_index_pattern("#{ilm_rollover_alias}-*")
464
- expect(@es.indices.get_template(name: ilm_rollover_alias)[ilm_rollover_alias]["settings"]['index']['lifecycle']['name']).to eq(ilm_policy_name)
465
- expect(@es.indices.get_template(name: ilm_rollover_alias)[ilm_rollover_alias]["settings"]['index']['lifecycle']['rollover_alias']).to eq(ilm_rollover_alias)
474
+
475
+ template = get_template(@es, ilm_rollover_alias)
476
+ expect(template).to have_index_pattern("#{ilm_rollover_alias}-*")
477
+ expect(get_template_settings(template)['index']['lifecycle']['name']).to eq(ilm_policy_name)
478
+ expect(get_template_settings(template)['index']['lifecycle']['rollover_alias']).to eq(ilm_rollover_alias)
466
479
  end
467
480
 
468
481
  context 'with a different template_name' do
469
- let (:template_name) { "custom_template_name" }
482
+ let (:template_name) { "logstash_custom_template_name" }
470
483
  let (:settings) { super.merge('template_name' => template_name)}
471
484
 
472
485
  it_behaves_like 'an ILM enabled Logstash'
@@ -474,9 +487,10 @@ if ESHelper.es_version_satisfies?(">= 6.6")
474
487
  it 'should write the ILM settings into the template' do
475
488
  subject.register
476
489
  sleep(1)
477
- expect(@es.indices.get_template(name: template_name)[template_name]).to have_index_pattern("#{ilm_rollover_alias}-*")
478
- expect(@es.indices.get_template(name: template_name)[template_name]["settings"]['index']['lifecycle']['name']).to eq(ilm_policy_name)
479
- expect(@es.indices.get_template(name: template_name)[template_name]["settings"]['index']['lifecycle']['rollover_alias']).to eq(ilm_rollover_alias)
490
+ template = get_template(@es, template_name)
491
+ expect(template).to have_index_pattern("#{ilm_rollover_alias}-*")
492
+ expect(get_template_settings(template)['index']['lifecycle']['name']).to eq(ilm_policy_name)
493
+ expect(get_template_settings(template)['index']['lifecycle']['rollover_alias']).to eq(ilm_rollover_alias)
480
494
  end
481
495
  end
482
496