logstash-input-elasticsearch 5.2.1 → 5.3.0

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: 1c6cb55dd7365bae4a363382b6fb927e54a94489347fa50eb212164b157c090b
4
- data.tar.gz: b19f9d63c887a46a13106dedba5cdac1f0715ed2beb8db622ede6b8f762890cf
3
+ metadata.gz: 90dc46d1bcadf70173792a9c2319925ea5e78bd3e6322e7c323de178afb72fa4
4
+ data.tar.gz: 21548a5935b0aa5b153b6e1bc00c7f9f3f6ade7f6546a0beb0ce7cc6cef5a984
5
5
  SHA512:
6
- metadata.gz: 1b5da3cb2c9de33cb94d9cc140cafe118f86de372f9eb7c7e77c2ec47356ee6d17f530a2c74e44111bf94e460b956ad5b55b20dc0467aa24b92a1b12accbe012
7
- data.tar.gz: 69307789e59c91e4c763bdc8ad1a4ef4c5090f6e8c3749587790652b44562ab16f54062e57a479965860cdfb619547ca54273d0850ea1cfed4753470712d1fe6
6
+ metadata.gz: 59e8a03c25d8ee9a1a02014b75d1096b81250b85c7f6bd7e78114764534d9ad244d5d758e974c84bc20d9aa0c8fad669a3ef636b17037426c30f2705d74083d2
7
+ data.tar.gz: 8b986365b25b8884e3aae581b37ce35f9190e50bf3ce4d17263887c31721efe16f16b97dcf2571dcb446991f7ea4406c6011a1d1dbd3afd7f3e07ec0c4b9b743
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 5.3.0
2
+ - Drop a support for Logstash 7.x by requiring elasticsearch gem >= 8. Logstash 8+ continues to work as before [#252](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/252)
3
+
4
+ ## 5.2.2
5
+ - [DOC] Note that `search_after` requires permissions on underlying indices/data streams, not aliases [#251](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/251)
6
+
1
7
  ## 5.2.1
2
8
  - Added support for encoded and non encoded api-key formats on plugin configuration [#237](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/237)
3
9
 
data/docs/index.asciidoc CHANGED
@@ -120,10 +120,10 @@ Examples include:
120
120
 
121
121
  The Elasticsearch input plugin provides the <<plugins-{type}s-{plugin}-tracking_field>> and <<plugins-{type}s-{plugin}-tracking_field_seed>> options.
122
122
  When <<plugins-{type}s-{plugin}-tracking_field>> is set, the plugin records the value of that field for the last document retrieved in a run into
123
- a file.
123
+ a file.
124
124
  (The file location defaults to <<plugins-{type}s-{plugin}-last_run_metadata_path>>.)
125
125
 
126
- You can then inject this value in the query using the placeholder `:last_value`.
126
+ You can then inject this value in the query using the placeholder `:last_value`.
127
127
  The value will be injected into the query before execution, and then updated after the query completes if new data was found.
128
128
 
129
129
  This feature works best when:
@@ -706,6 +706,8 @@ The query requires at least one `sort` field, as described in the <<plugins-{typ
706
706
 
707
707
  `scroll` uses {ref}/paginate-search-results.html#scroll-search-results[scroll] API to search, which is no longer recommended.
708
708
 
709
+ NOTE: When using `search_after`, including using `auto` on Elasticsearch 8+, permissions to read data aliases alone will not work: permissions are also needed on the underlying indices or data streams.
710
+
709
711
  [id="plugins-{type}s-{plugin}-size"]
710
712
  ===== `size`
711
713
 
@@ -13,6 +13,7 @@ require "logstash/plugin_mixins/normalize_config_support"
13
13
  require "base64"
14
14
 
15
15
  require "elasticsearch"
16
+ require "elastic/transport/transport/http/manticore"
16
17
  require "manticore"
17
18
 
18
19
  # .Compatibility Note
@@ -350,7 +351,7 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
350
351
  @client_options = {
351
352
  :hosts => hosts,
352
353
  :transport_options => transport_options,
353
- :transport_class => get_transport_client_class,
354
+ :transport_class => ::Elastic::Transport::Transport::HTTP::Manticore,
354
355
  :ssl => ssl_options
355
356
  }
356
357
 
@@ -728,20 +729,6 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
728
729
  last_run_metadata_path
729
730
  end
730
731
 
731
- def get_transport_client_class
732
- # LS-core includes `elasticsearch` gem. The gem is composed of two separate gems: `elasticsearch-api` and `elasticsearch-transport`
733
- # And now `elasticsearch-transport` is old, instead we have `elastic-transport`.
734
- # LS-core updated `elasticsearch` > 8: https://github.com/elastic/logstash/pull/17161
735
- # Following source bits are for the compatibility to support both `elasticsearch-transport` and `elastic-transport` gems
736
- require "elasticsearch/transport/transport/http/manticore"
737
- require_relative "elasticsearch/patches/_elasticsearch_transport_http_manticore"
738
- require_relative "elasticsearch/patches/_elasticsearch_transport_connections_selector"
739
- ::Elasticsearch::Transport::Transport::HTTP::Manticore
740
- rescue ::LoadError
741
- require "elastic/transport/transport/http/manticore"
742
- ::Elastic::Transport::Transport::HTTP::Manticore
743
- end
744
-
745
732
  def validate_ls_version_for_esql_support!
746
733
  if Gem::Version.create(LOGSTASH_VERSION) < Gem::Version.create(LS_ESQL_SUPPORT_VERSION)
747
734
  fail("Current version of Logstash does not include Elasticsearch client which supports ES|QL. Please upgrade Logstash to at least #{LS_ESQL_SUPPORT_VERSION}")
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-elasticsearch'
4
- s.version = '5.2.1'
4
+ s.version = ::File.read('version').split("\n").first
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Reads query results from an Elasticsearch cluster"
7
7
  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"
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_runtime_dependency "logstash-mixin-validator_support", '~> 1.0'
27
27
  s.add_runtime_dependency "logstash-mixin-scheduler", '~> 1.0'
28
28
 
29
- s.add_runtime_dependency 'elasticsearch', '>= 7.17.9', '< 9'
29
+ s.add_runtime_dependency 'elasticsearch', '>= 8', '< 10'
30
30
  s.add_runtime_dependency 'logstash-mixin-ca_trusted_fingerprint_support', '~> 1.0'
31
31
  s.add_runtime_dependency 'logstash-mixin-normalize_config_support', '~>1.0'
32
32
 
@@ -39,7 +39,4 @@ Gem::Specification.new do |s|
39
39
  s.add_development_dependency 'timecop'
40
40
  s.add_development_dependency 'cabin', ['~> 0.6']
41
41
  s.add_development_dependency 'webrick'
42
-
43
- # 3.8.0 has breaking changes WRT to joining, which break our specs
44
- s.add_development_dependency 'rufus-scheduler', '~> 3.0.9'
45
42
  end
@@ -1 +1 @@
1
- 2024-12-26T22:27:15+00:00
1
+ 2026-01-21T16:16:02+01:00
@@ -1,7 +1,7 @@
1
1
  -----BEGIN CERTIFICATE-----
2
2
  MIIDFTCCAf2gAwIBAgIBATANBgkqhkiG9w0BAQsFADA0MTIwMAYDVQQDEylFbGFz
3
- dGljIENlcnRpZmljYXRlIFRvb2wgQXV0b2dlbmVyYXRlZCBDQTAeFw0yNDEyMjYy
4
- MjI3MTVaFw0yNTEyMjYyMjI3MTVaMDQxMjAwBgNVBAMTKUVsYXN0aWMgQ2VydGlm
3
+ dGljIENlcnRpZmljYXRlIFRvb2wgQXV0b2dlbmVyYXRlZCBDQTAeFw0yNjAxMjEx
4
+ NTE2MDJaFw0yNzAxMjExNTE2MDJaMDQxMjAwBgNVBAMTKUVsYXN0aWMgQ2VydGlm
5
5
  aWNhdGUgVG9vbCBBdXRvZ2VuZXJhdGVkIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
6
6
  AQ8AMIIBCgKCAQEArUe66xG4Y2zO13gRC+rBwyvxe+c01pqV6ukw6isIbJIQWs1/
7
7
  QfEMhUwYwKs6/UXxK+VwardcA2zYwngXbGGEtms+mpUfH5CdJnrqW7lHz1BVK4yH
@@ -10,10 +10,10 @@ QfEMhUwYwKs6/UXxK+VwardcA2zYwngXbGGEtms+mpUfH5CdJnrqW7lHz1BVK4yH
10
10
  i4lUiR6Uo9D6WMFjeRYFF7GolCy/I1SzWBmmOnNhQLO5VxcNG4ldhBcapZeGwE98
11
11
  m/5lxLIwgFR9ZP8bXdxZTWLC58/LQ2NqOjA9mwIDAQABozIwMDAPBgNVHRMBAf8E
12
12
  BTADAQH/MB0GA1UdDgQWBBTIJMnuftpfkxNCOkbF0R4xgcKQRjANBgkqhkiG9w0B
13
- AQsFAAOCAQEAhfg/cmXc4Uh90yiXU8jOW8saQjTsq4ZMDQiLfJsNmNNYmHFN0vhv
14
- lJRI1STdy7+GpjS5QbrMjQIxWSS8X8xysE4Rt81IrWmLuao35TRFyoiE1seBQ5sz
15
- p/BxZUe57JvWi9dyzv2df4UfWFdGBhzdr80odZmz4i5VIv6qCKJKsGikcuLpepmp
16
- E/UKnKHeR/dFWsxzA9P2OzHTUNBMOOA2PyAUL49pwoChwJeOWN/zAgwMWLbuHFG0
17
- IN0u8swAmeH98QdvzbhiOatGNpqfTNvQEDc19yVjfXKpBVZQ79WtronYSqrbrUa1
18
- T2zD8bIVP7CdddD/UmpT1SSKh4PJxudy5Q==
13
+ AQsFAAOCAQEAYoiQ5m/wtwsiEDr173OouhEWmL9zGPZ0Oi8XAJACilyHos++U15M
14
+ uer+s/Glxm0wrf7VcD7JAKWOp3Pm/P3A5DqmYgO52FXEAucvXPdZNbi1RskzGi2N
15
+ jgjrZXC2EVsvBo05iPfPL0hPdvY1Ax00ILFQOgaamAyMJG4W/n597nzWWKPboDT3
16
+ S2NVlWHMht53XQprAdmolcnBg799mkYloJ5N7HFJXwTN/rw0U/WUj5JVMkOf0ECp
17
+ y1Z+0K6s/gIA4muDzCWS6qpJa0CJfrPloXceTJdLpaYX+HFmL0prTwCo8wtjKGHp
18
+ 0GSbZob3aT2qWSxU/9od5FhjnFjCheki6Q==
19
19
  -----END CERTIFICATE-----
@@ -1 +1 @@
1
- b1e955819b0d14f64f863adb103c248ddacf2e17bea48d04ee4b57c64814ccc4
1
+ 516ffaaddd40a9dfd5962eacc76933af9a00cdaea70a2ea0bb19c13f38ac4cc6
@@ -1,7 +1,7 @@
1
1
  -----BEGIN CERTIFICATE-----
2
2
  MIIDIzCCAgugAwIBAgIBATANBgkqhkiG9w0B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ktNe/NQJzgYSaMnlIuHVLFdxJYmwU
15
- T1cP6VC/brmqP/dd5y7VWE7Lp+Wd5CxKl/WY+9chmgc+a1fW/lnPEJJ6pca1Bo8b
16
- byIL0yY2IUv4R2eh1IyQl9oGH1GOPLgO7cY04eajxYcOVA2eDSItoyDtrJfkFP/P
17
- UXtC1JAkvWKuujFEiBj0AannhroWlp3gvChhBwCuCAU0KXD6g8BE8tn6oT1+FW7J
18
- avSfHxAe+VHtYhF8sJ8jrdm0d7E4GKS9UR/pkLAL1JuRdJ1VkPx3
13
+ wpBGMA0GCSqGSIb3DQEBCwUAA4IBAQAE/PyIBt4Y3Ihg3F00c3rw4++b639iIP10
14
+ eeZ29UUNGjKceS7iaQgpN+JCVRHz3K3cCbh4rczCX9fH/u60bXVMUesrtEOcNN54
15
+ dzqIgTXEE3BygaQC29+BoG+JOa0aoYzHS64O+SeRXd+Fhc36c2ZTM1hG2Tt22CsP
16
+ tPH51dlFWo9d5QpsRRsQBC0RmOP1EnBPl55veIbtKELRNqF8tklindfYk71caBpo
17
+ Oo2iaRbUfAP7bsbsdlnLcvLmIKiKWyCIsQBWdxJTKZNjqzGcYpGAPsw4Mo9QHI03
18
+ P4gSoSvW4MZiL0BnWMeRplyt74JBPJhPTesMLpTZvBtOeIURciCo
19
19
  -----END CERTIFICATE-----
@@ -18,16 +18,9 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
18
18
  let(:plugin) { described_class.new(config) }
19
19
  let(:queue) { Queue.new }
20
20
  let(:build_flavor) { "default" }
21
- let(:es_version) { "7.5.0" }
21
+ let(:es_version) { "8.19.10" }
22
22
  let(:cluster_info) { {"version" => {"number" => es_version, "build_flavor" => build_flavor}, "tagline" => "You Know, for Search"} }
23
23
 
24
- def elastic_ruby_v8_client_available?
25
- Elasticsearch::Transport
26
- false
27
- rescue NameError # NameError: uninitialized constant Elasticsearch::Transport if Elastic Ruby client is not available
28
- true
29
- end
30
-
31
24
  before(:each) do
32
25
  Elasticsearch::Client.send(:define_method, :ping) { } # define no-action ping method
33
26
  allow_any_instance_of(Elasticsearch::Client).to receive(:info).and_return(cluster_info)
@@ -36,7 +29,8 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
36
29
  let(:base_config) do
37
30
  {
38
31
  'hosts' => ["localhost"],
39
- 'query' => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }'
32
+ 'query' => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }',
33
+ 'search_api' => 'scroll'
40
34
  }
41
35
  end
42
36
 
@@ -55,13 +49,13 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
55
49
  it "does not set header Elastic-Api-Version" do
56
50
  plugin.register
57
51
  client = plugin.send(:client)
58
- expect( extract_transport(client).options[:transport_options][:headers] ).not_to match hash_including("Elastic-Api-Version" => "2023-10-31")
52
+ expect( client.transport.options[:transport_options][:headers] ).not_to match hash_including("Elastic-Api-Version" => "2023-10-31")
59
53
  end
60
54
 
61
55
  it "sets an x-elastic-product-origin header identifying this as an internal plugin request" do
62
56
  plugin.register
63
57
  client = plugin.send(:client)
64
- expect( extract_transport(client).options[:transport_options][:headers] ).to match hash_including("x-elastic-product-origin"=>"logstash-input-elasticsearch")
58
+ expect( client.transport.options[:transport_options][:headers] ).to match hash_including("x-elastic-product-origin"=>"logstash-input-elasticsearch")
65
59
  end
66
60
  end
67
61
 
@@ -99,11 +93,7 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
99
93
 
100
94
  before do
101
95
  allow(Elasticsearch::Client).to receive(:new).and_return(es_client)
102
- if elastic_ruby_v8_client_available?
103
- allow(es_client).to receive(:info).and_raise(Elastic::Transport::Transport::Errors::BadRequest.new)
104
- else
105
- allow(es_client).to receive(:info).and_raise(Elasticsearch::Transport::Transport::Errors::BadRequest.new)
106
- end
96
+ allow(es_client).to receive(:info).and_raise(Elastic::Transport::Transport::Errors::BadRequest.new)
107
97
  end
108
98
 
109
99
  it "raises an exception" do
@@ -116,13 +106,13 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
116
106
  expect_any_instance_of(Elasticsearch::Client).to receive(:info).and_return(true)
117
107
  plugin.register
118
108
  client = plugin.send(:client)
119
- expect( extract_transport(client).options[:transport_options][:headers] ).to match hash_including("Elastic-Api-Version" => "2023-10-31")
109
+ expect( client.transport.options[:transport_options][:headers] ).to match hash_including("Elastic-Api-Version" => "2023-10-31")
120
110
  end
121
111
 
122
112
  it "sets an x-elastic-product-origin header identifying this as an internal plugin request" do
123
113
  plugin.register
124
114
  client = plugin.send(:client)
125
- expect( extract_transport(client).options[:transport_options][:headers] ).to match hash_including("x-elastic-product-origin"=>"logstash-input-elasticsearch")
115
+ expect( client.transport.options[:transport_options][:headers] ).to match hash_including("x-elastic-product-origin"=>"logstash-input-elasticsearch")
126
116
  end
127
117
  end
128
118
 
@@ -138,7 +128,7 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
138
128
  it "sets custom headers" do
139
129
  plugin.register
140
130
  client = plugin.send(:client)
141
- expect( extract_transport(client).options[:transport_options][:headers] ).to match hash_including(config["custom_headers"])
131
+ expect( client.transport.options[:transport_options][:headers] ).to match hash_including(config["custom_headers"])
142
132
  end
143
133
  end
144
134
  end
@@ -190,11 +180,12 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
190
180
  "_type" => "logs",
191
181
  "_id" => "C5b2xLQwTZa76jBmHIbwHQ",
192
182
  "_score" => 1.0,
193
- "_source" => { "message" => ["ohayo"] }
183
+ "_source" => { "message" => ["ohayo"] },
184
+ "sort" => [1]
194
185
  }
195
186
  allow(@esclient).to receive(:search) { { "hits" => { "hits" => [hit] } } }
196
- allow(@esclient).to receive(:scroll) { { "hits" => { "hits" => [hit] } } }
197
- allow(@esclient).to receive(:clear_scroll).and_return(nil)
187
+ allow(@esclient).to receive(:open_point_in_time).and_return({"id" => "test-pit-id"})
188
+ allow(@esclient).to receive(:close_point_in_time).and_return(nil)
198
189
  allow(@esclient).to receive(:ping)
199
190
  allow(@esclient).to receive(:info).and_return(cluster_info)
200
191
  end
@@ -210,7 +201,8 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
210
201
  let(:config) do
211
202
  {
212
203
  'hosts' => ["localhost"],
213
- 'query' => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }'
204
+ 'query' => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }',
205
+ 'search_api' => 'scroll'
214
206
  }
215
207
  end
216
208
 
@@ -269,7 +261,8 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
269
261
  {
270
262
  'hosts' => ["localhost"],
271
263
  'query' => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }',
272
- 'target' => "[@metadata][_source]"
264
+ 'target' => "[@metadata][_source]",
265
+ 'search_api' => 'scroll'
273
266
  }
274
267
  end
275
268
 
@@ -293,7 +286,8 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
293
286
  'query' => "#{LogStash::Json.dump(query)}",
294
287
  'slices' => slices,
295
288
  'docinfo' => true, # include ids
296
- 'docinfo_target' => '[@metadata]'
289
+ 'docinfo_target' => '[@metadata]',
290
+ 'search_api' => 'scroll'
297
291
  }
298
292
  end
299
293
  let(:query) do
@@ -753,13 +747,7 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
753
747
  it "should set host(s)" do
754
748
  plugin.register
755
749
  client = plugin.send(:client)
756
- target_field = :@seeds
757
- begin
758
- Elasticsearch::Transport::Client
759
- rescue
760
- target_field = :@hosts
761
- end
762
- expect( client.transport.instance_variable_get(target_field) ).to eql [{
750
+ expect( client.transport.instance_variable_get(:@hosts) ).to eql [{
763
751
  :scheme => "https",
764
752
  :host => "ac31ebb90241773157043c34fd26fd46.us-central1.gcp.cloud.es.io",
765
753
  :port => 9243,
@@ -791,7 +779,7 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
791
779
  it "should set authorization" do
792
780
  plugin.register
793
781
  client = plugin.send(:client)
794
- auth_header = extract_transport(client).options[:transport_options][:headers]['Authorization']
782
+ auth_header = client.transport.options[:transport_options][:headers]['Authorization']
795
783
 
796
784
  expect( auth_header ).to eql "Basic #{Base64.encode64('elastic:my-passwd-00').rstrip}"
797
785
  end
@@ -831,7 +819,7 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
831
819
  it "correctly sets the Authorization header" do
832
820
  plugin.register
833
821
  client = plugin.send(:client)
834
- auth_header = extract_transport(client).options[:transport_options][:headers]['Authorization']
822
+ auth_header = client.transport.options[:transport_options][:headers]['Authorization']
835
823
 
836
824
  expect(auth_header).to eql("ApiKey #{encoded_api_key}")
837
825
  end
@@ -871,7 +859,7 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
871
859
  it "should set proxy" do
872
860
  plugin.register
873
861
  client = plugin.send(:client)
874
- proxy = extract_transport(client).options[:transport_options][:proxy]
862
+ proxy = client.transport.options[:transport_options][:proxy]
875
863
 
876
864
  expect( proxy ).to eql "http://localhost:1234"
877
865
  end
@@ -883,7 +871,7 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
883
871
  plugin.register
884
872
  client = plugin.send(:client)
885
873
 
886
- expect( extract_transport(client).options[:transport_options] ).to_not include(:proxy)
874
+ expect( client.transport.options[:transport_options] ).to_not include(:proxy)
887
875
  end
888
876
  end
889
877
  end
@@ -911,15 +899,15 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
911
899
  "cluster_name": "docker-cluster",
912
900
  "cluster_uuid": "DyR1hN03QvuCWXRy3jtb0g",
913
901
  "version": {
914
- "number": "7.13.1",
902
+ "number": "8.13.1",
915
903
  "build_flavor": "default",
916
904
  "build_type": "docker",
917
905
  "build_hash": "9a7758028e4ea59bcab41c12004603c5a7dd84a9",
918
- "build_date": "2021-05-28T17:40:59.346932922Z",
906
+ "build_date": "2024-05-28T17:40:59.346932922Z",
919
907
  "build_snapshot": false,
920
- "lucene_version": "8.8.2",
921
- "minimum_wire_compatibility_version": "6.8.0",
922
- "minimum_index_compatibility_version": "6.0.0-beta1"
908
+ "lucene_version": "9.10.0",
909
+ "minimum_wire_compatibility_version": "7.17.0",
910
+ "minimum_index_compatibility_version": "7.0.0"
923
911
  },
924
912
  "tagline": "You Know, for Search"
925
913
  }
@@ -1020,8 +1008,6 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
1020
1008
  let(:plugin) { described_class.new(config) }
1021
1009
  let(:event) { LogStash::Event.new({}) }
1022
1010
 
1023
- # elasticsearch-ruby 7.17.9 initialize two user agent headers, `user-agent` and `User-Agent`
1024
- # hence, fail this header size test case
1025
1011
  xit "client should sent the expect user-agent" do
1026
1012
  plugin.register
1027
1013
 
@@ -1220,6 +1206,7 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
1220
1206
  end
1221
1207
 
1222
1208
  describe "scroll" do
1209
+ let(:config) { super().merge({ "search_api" => "scroll" }) }
1223
1210
  let(:search_response) do
1224
1211
  {
1225
1212
  "_scroll_id" => "cXVlcnlUaGVuRmV0Y2g",
@@ -1379,11 +1366,6 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
1379
1366
  end
1380
1367
  end
1381
1368
 
1382
- # @note can be removed once we depends on elasticsearch gem >= 6.x
1383
- def extract_transport(client) # on 7.x client.transport is a ES::Transport::Client
1384
- client.transport.respond_to?(:transport) ? client.transport.transport : client.transport
1385
- end
1386
-
1387
1369
  describe "#ESQL" do
1388
1370
  let(:config) do
1389
1371
  {
@@ -14,7 +14,7 @@ describe "SSL options" do
14
14
  before do
15
15
  allow(es_client_double).to receive(:close)
16
16
  allow(es_client_double).to receive(:ping).with(any_args).and_return(double("pong").as_null_object)
17
- allow(es_client_double).to receive(:info).and_return({"version" => {"number" => "7.5.0", "build_flavor" => "default"},
17
+ allow(es_client_double).to receive(:info).and_return({"version" => {"number" => "8.19.0", "build_flavor" => "default"},
18
18
  "tagline" => "You Know, for Search"})
19
19
  allow(Elasticsearch::Client).to receive(:new).and_return(es_client_double)
20
20
  end
@@ -77,11 +77,7 @@ describe LogStash::Inputs::Elasticsearch do
77
77
  it_behaves_like 'an elasticsearch index plugin'
78
78
 
79
79
  let(:unauth_exception_class) do
80
- begin
81
- Elasticsearch::Transport::Transport::Errors::Unauthorized
82
- rescue
83
- Elastic::Transport::Transport::Errors::Unauthorized
84
- end
80
+ Elastic::Transport::Transport::Errors::Unauthorized
85
81
  end
86
82
 
87
83
  context "incorrect auth credentials" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.1
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-09-23 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: logstash-core-plugin-api
@@ -91,20 +91,20 @@ dependencies:
91
91
  requirements:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: 7.17.9
94
+ version: '8'
95
95
  - - "<"
96
96
  - !ruby/object:Gem::Version
97
- version: '9'
97
+ version: '10'
98
98
  type: :runtime
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: 7.17.9
104
+ version: '8'
105
105
  - - "<"
106
106
  - !ruby/object:Gem::Version
107
- version: '9'
107
+ version: '10'
108
108
  - !ruby/object:Gem::Dependency
109
109
  name: logstash-mixin-ca_trusted_fingerprint_support
110
110
  requirement: !ruby/object:Gem::Requirement
@@ -245,20 +245,6 @@ dependencies:
245
245
  - - ">="
246
246
  - !ruby/object:Gem::Version
247
247
  version: '0'
248
- - !ruby/object:Gem::Dependency
249
- name: rufus-scheduler
250
- requirement: !ruby/object:Gem::Requirement
251
- requirements:
252
- - - "~>"
253
- - !ruby/object:Gem::Version
254
- version: 3.0.9
255
- type: :development
256
- prerelease: false
257
- version_requirements: !ruby/object:Gem::Requirement
258
- requirements:
259
- - - "~>"
260
- - !ruby/object:Gem::Version
261
- version: 3.0.9
262
248
  description: This gem is a Logstash plugin required to be installed on top of the
263
249
  Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
264
250
  gem is not a stand-alone program
@@ -280,8 +266,6 @@ files:
280
266
  - lib/logstash/inputs/elasticsearch/cursor_tracker.rb
281
267
  - lib/logstash/inputs/elasticsearch/esql.rb
282
268
  - lib/logstash/inputs/elasticsearch/paginated_search.rb
283
- - lib/logstash/inputs/elasticsearch/patches/_elasticsearch_transport_connections_selector.rb
284
- - lib/logstash/inputs/elasticsearch/patches/_elasticsearch_transport_http_manticore.rb
285
269
  - logstash-input-elasticsearch.gemspec
286
270
  - spec/es_helper.rb
287
271
  - spec/fixtures/test_certs/GENERATED_AT
@@ -319,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
319
303
  - !ruby/object:Gem::Version
320
304
  version: '0'
321
305
  requirements: []
322
- rubygems_version: 3.6.3
306
+ rubygems_version: 3.7.2
323
307
  specification_version: 4
324
308
  summary: Reads query results from an Elasticsearch cluster
325
309
  test_files:
@@ -1,51 +0,0 @@
1
- require 'elasticsearch'
2
- require 'elasticsearch/transport/transport/connections/selector'
3
-
4
- if Gem.loaded_specs['elasticsearch-transport'].version < Gem::Version.new("7.2.0")
5
- # elasticsearch-transport versions prior to 7.2.0 suffered of a race condition on accessing
6
- # the connection pool. This issue was fixed (in 7.2.0) with
7
- # https://github.com/elastic/elasticsearch-ruby/commit/15f9d78591a6e8823948494d94b15b0ca38819d1
8
- #
9
- # This plugin, at the moment, is using elasticsearch >= 5.0.5
10
- # When this requirement ceases, this patch could be removed.
11
- module Elasticsearch
12
- module Transport
13
- module Transport
14
- module Connections
15
- module Selector
16
-
17
- # "Round-robin" selector strategy (default).
18
- #
19
- class RoundRobin
20
- include Base
21
-
22
- # @option arguments [Connections::Collection] :connections Collection with connections.
23
- #
24
- def initialize(arguments = {})
25
- super
26
- @mutex = Mutex.new
27
- @current = nil
28
- end
29
-
30
- # Returns the next connection from the collection, rotating them in round-robin fashion.
31
- #
32
- # @return [Connections::Connection]
33
- #
34
- def select(options={})
35
- @mutex.synchronize do
36
- conns = connections
37
- if @current && (@current < conns.size-1)
38
- @current += 1
39
- else
40
- @current = 0
41
- end
42
- conns[@current]
43
- end
44
- end
45
- end
46
- end
47
- end
48
- end
49
- end
50
- end
51
- end
@@ -1,43 +0,0 @@
1
- # encoding: utf-8
2
- require "elasticsearch"
3
- require "elasticsearch/transport/transport/http/manticore"
4
-
5
- es_client_version = Gem.loaded_specs['elasticsearch-transport'].version
6
- if es_client_version >= Gem::Version.new('7.2') && es_client_version < Gem::Version.new('7.16')
7
- # elasticsearch-transport 7.2.0 - 7.14.0 had a bug where setting http headers
8
- # ES::Client.new ..., transport_options: { headers: { 'Authorization' => ... } }
9
- # would be lost https://github.com/elastic/elasticsearch-ruby/issues/1428
10
- #
11
- # NOTE: needs to be idempotent as filter ES plugin might apply the same patch!
12
- #
13
- # @private
14
- module Elasticsearch
15
- module Transport
16
- module Transport
17
- module HTTP
18
- class Manticore
19
-
20
- def apply_headers(request_options, options)
21
- headers = (options && options[:headers]) || {}
22
- headers[CONTENT_TYPE_STR] = find_value(headers, CONTENT_TYPE_REGEX) || DEFAULT_CONTENT_TYPE
23
-
24
- # this code is necessary to grab the correct user-agent header
25
- # when this method is invoked with apply_headers(@request_options, options)
26
- # from https://github.com/elastic/elasticsearch-ruby/blob/v7.14.0/elasticsearch-transport/lib/elasticsearch/transport/transport/http/manticore.rb#L113-L114
27
- transport_user_agent = nil
28
- if (options && options[:transport_options] && options[:transport_options][:headers])
29
- transport_headers = options[:transport_options][:headers]
30
- transport_user_agent = find_value(transport_headers, USER_AGENT_REGEX)
31
- end
32
-
33
- headers[USER_AGENT_STR] = transport_user_agent || find_value(headers, USER_AGENT_REGEX) || user_agent_header
34
- headers[ACCEPT_ENCODING] = GZIP if use_compression?
35
- (request_options[:headers] ||= {}).merge!(headers) # this line was changed
36
- end
37
-
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end