Skip to content

Commit 4cecce6

Browse files
committed
Adds elastic-transport client support where opens LS-core a way to start using newer ES ruby client.
1 parent 5f6e8da commit 4cecce6

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 5.0.2
2+
- Adds elastic-transport support [#223](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/223)
3+
14
## 5.0.1
25
- Fix: prevent plugin crash when hits contain illegal structure [#218](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/218)
36
- When a hit cannot be converted to an event, the input now emits an event tagged with `_elasticsearch_input_failure` with an `[event][original]` containing a JSON-encoded string representation of the entire hit.

lib/logstash/inputs/elasticsearch.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
require "base64"
1414

1515
require "elasticsearch"
16-
require "elasticsearch/transport/transport/http/manticore"
17-
require_relative "elasticsearch/patches/_elasticsearch_transport_http_manticore"
18-
require_relative "elasticsearch/patches/_elasticsearch_transport_connections_selector"
1916

2017
# .Compatibility Note
2118
# [NOTE]
@@ -316,7 +313,7 @@ def register
316313
@client_options = {
317314
:hosts => hosts,
318315
:transport_options => transport_options,
319-
:transport_class => ::Elasticsearch::Transport::Transport::HTTP::Manticore,
316+
:transport_class => get_transport_client_class,
320317
:ssl => ssl_options
321318
}
322319

@@ -642,6 +639,16 @@ def setup_query_executor
642639
end
643640
end
644641

642+
def get_transport_client_class
643+
require "elasticsearch/transport/transport/http/manticore"
644+
require_relative "elasticsearch/patches/_elasticsearch_transport_http_manticore"
645+
require_relative "elasticsearch/patches/_elasticsearch_transport_connections_selector"
646+
::Elasticsearch::Transport::Transport::HTTP::Manticore
647+
rescue ::LoadError
648+
require "elastic/transport/transport/http/manticore"
649+
::Elastic::Transport::Transport::HTTP::Manticore
650+
end
651+
645652
module URIOrEmptyValidator
646653
##
647654
# @override to provide :uri_or_empty validator

logstash-input-elasticsearch.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Gem::Specification.new do |s|
22

33
s.name = 'logstash-input-elasticsearch'
4-
s.version = '5.0.1'
4+
s.version = '5.0.2'
55
s.licenses = ['Apache License (2.0)']
66
s.summary = "Reads query results from an Elasticsearch cluster"
77
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"
88
s.authors = ["Elastic"]
99
s.email = '[email protected]'
10-
s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
10+
s.homepage = "https://elastic.co/logstash"
1111
s.require_paths = ["lib"]
1212

1313
# Files

0 commit comments

Comments
 (0)