logstash-output-elasticsearch 12.1.5-java → 12.1.6-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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84a9fb2d6f4345422640ad3b59e9c0cb59b330569cbd33dc79cc1356b828bd34
4
- data.tar.gz: 73375c880a26de3986cc1b984f3f898af055f040e1b3ea8e9772c1be78c03a3f
3
+ metadata.gz: 1cdbd34639c856955089e567feefe731b38ca8c6990207f5eb23bf4b82e7b655
4
+ data.tar.gz: 6f6faff70fc33714ae9ae49b44d046abcbf45d51cf3d986d03580d63f104d859
5
5
  SHA512:
6
- metadata.gz: b5c8e15da6a79b51df996e6295687281d1dd19d668b6443455aeee3218e2c88f1aea271560cdad6bbde6a5c1ce44085e9bac4acb8dd65f4b84a596f589be1369
7
- data.tar.gz: 5ae3d4135fd0f18460b7872b58f8385ed254c9154cd150116f43cae5b54557e92a0ac7403fac7e51161b1ffc24171cf49571662c25684a46adb02a866e73e720
6
+ metadata.gz: c78e7bb0162c33b4ec4ae39ceb9a9fe16f16a8f3c3ef6cda426ceaf9adf2a5d415bea2398a1d2e20ec414dab258c3d95135666f3dbfffa532a455c3ffeb91f32
7
+ data.tar.gz: 620d9d85ab8425dffbdc89f8dfa45d5b65b741ab29aca914d6039ea9619e1706893a2b6dc4b7f301a3a631f4842ce1681c3cbb024352c6e31f0429b4118cee16
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 12.1.6
2
+ - Fix serverless compatibility: nil params in pool requests and unsupported template settings [#1276](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1276)
3
+
1
4
  ## 12.1.5
2
5
  - Support Elastic Cloud API keys in the `api_key` option, which now accepts an `id:api_key` pair, its base64-encoded form, or an `essu_` Cloud API key, and rejects an unrecognized format at startup [#1274](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1274)
3
6
 
@@ -350,6 +350,7 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
350
350
  end
351
351
 
352
352
  def perform_request_to_url(url, method, path, params={}, body=nil)
353
+ params ||= {}
353
354
  params[:headers] = DEFAULT_EAV_HEADER.merge(params[:headers] || {}) if serverless?
354
355
  @adapter.perform_request(url, method, path, params, body)
355
356
  end
@@ -433,7 +433,7 @@ module LogStash; module Outputs; class ElasticSearch;
433
433
  def template_put(template_endpoint, name, template)
434
434
  path = "#{template_endpoint}/#{name}"
435
435
  logger.info("Installing Elasticsearch template", name: name)
436
- @pool.put(path, nil, LogStash::Json.dump(template))
436
+ @pool.put(path, {}, LogStash::Json.dump(template))
437
437
  rescue ::LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError => e
438
438
  raise e unless e.response_code == 404
439
439
  end
@@ -447,7 +447,7 @@ module LogStash; module Outputs; class ElasticSearch;
447
447
 
448
448
  # Create a new rollover alias
449
449
  def rollover_alias_put(alias_name, alias_definition)
450
- @pool.put(CGI::escape(alias_name), nil, LogStash::Json.dump(alias_definition))
450
+ @pool.put(CGI::escape(alias_name), {}, LogStash::Json.dump(alias_definition))
451
451
  logger.info("Created rollover alias", name: alias_name)
452
452
  # If the rollover alias already exists, ignore the error that comes back from Elasticsearch
453
453
  rescue ::LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError => e
@@ -473,7 +473,7 @@ module LogStash; module Outputs; class ElasticSearch;
473
473
  def ilm_policy_put(name, policy)
474
474
  path = "_ilm/policy/#{name}"
475
475
  logger.info("Installing ILM policy #{policy}", name: name)
476
- @pool.put(path, nil, LogStash::Json.dump(policy))
476
+ @pool.put(path, {}, LogStash::Json.dump(policy))
477
477
  end
478
478
 
479
479
 
@@ -28,6 +28,7 @@ module LogStash; module Outputs; class ElasticSearch
28
28
  end
29
29
 
30
30
  add_ilm_settings_to_template(plugin, template) if plugin.ilm_in_use?
31
+ strip_serverless_incompatible_settings(template) if plugin.serverless?
31
32
  plugin.logger.debug("Attempting to install template", template: template)
32
33
  install(plugin.client, template_endpoint(plugin), template_name(plugin), template, plugin.template_overwrite)
33
34
  end
@@ -129,5 +130,19 @@ module LogStash; module Outputs; class ElasticSearch
129
130
  end
130
131
  end
131
132
 
133
+ SERVERLESS_INCOMPATIBLE_SETTINGS = %w[
134
+ number_of_shards
135
+ index.number_of_shards
136
+ number_of_replicas
137
+ index.number_of_replicas
138
+ ].freeze
139
+
140
+ def self.strip_serverless_incompatible_settings(template)
141
+ settings = template.dig('template', 'settings') || template['settings']
142
+ return unless settings
143
+
144
+ SERVERLESS_INCOMPATIBLE_SETTINGS.each { |s| settings.delete(s) }
145
+ end
146
+
132
147
  end
133
148
  end end end
@@ -181,4 +181,75 @@ describe LogStash::Outputs::ElasticSearch::TemplateManager do
181
181
 
182
182
  end
183
183
  end
184
+
185
+ describe ".strip_serverless_incompatible_settings" do
186
+ context "with composable template (template.settings)" do
187
+ let(:template) do
188
+ {
189
+ "template" => {
190
+ "settings" => {
191
+ "index.refresh_interval" => "5s",
192
+ "number_of_shards" => 1,
193
+ "number_of_replicas" => 0
194
+ }
195
+ }
196
+ }
197
+ end
198
+
199
+ it "removes number_of_shards and number_of_replicas" do
200
+ described_class.strip_serverless_incompatible_settings(template)
201
+ expect(template["template"]["settings"]).not_to have_key("number_of_shards")
202
+ expect(template["template"]["settings"]).not_to have_key("number_of_replicas")
203
+ end
204
+
205
+ it "preserves compatible settings" do
206
+ described_class.strip_serverless_incompatible_settings(template)
207
+ expect(template["template"]["settings"]["index.refresh_interval"]).to eq("5s")
208
+ end
209
+ end
210
+
211
+ context "with index-prefixed setting keys" do
212
+ let(:template) do
213
+ {
214
+ "template" => {
215
+ "settings" => {
216
+ "index.number_of_shards" => 1,
217
+ "index.number_of_replicas" => 0
218
+ }
219
+ }
220
+ }
221
+ end
222
+
223
+ it "removes index-prefixed variants" do
224
+ described_class.strip_serverless_incompatible_settings(template)
225
+ expect(template["template"]["settings"]).not_to have_key("index.number_of_shards")
226
+ expect(template["template"]["settings"]).not_to have_key("index.number_of_replicas")
227
+ end
228
+ end
229
+
230
+ context "with legacy template (top-level settings)" do
231
+ let(:template) do
232
+ {
233
+ "settings" => {
234
+ "index.refresh_interval" => "5s",
235
+ "number_of_shards" => 1
236
+ }
237
+ }
238
+ end
239
+
240
+ it "removes incompatible settings from top-level settings" do
241
+ described_class.strip_serverless_incompatible_settings(template)
242
+ expect(template["settings"]).not_to have_key("number_of_shards")
243
+ expect(template["settings"]["index.refresh_interval"]).to eq("5s")
244
+ end
245
+ end
246
+
247
+ context "with no settings" do
248
+ let(:template) { { "mappings" => {} } }
249
+
250
+ it "does not raise" do
251
+ expect { described_class.strip_serverless_incompatible_settings(template) }.not_to raise_error
252
+ end
253
+ end
254
+ end
184
255
  end
data/version CHANGED
@@ -1 +1 @@
1
- 12.1.5
1
+ 12.1.6
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.1.5
4
+ version: 12.1.6
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-07-03 00:00:00.000000000 Z
10
+ date: 2026-07-06 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: manticore