Module: LogStash::PluginMixins::EnterpriseSearch::ManticoreTransport
- Included in:
- AppSearch::Client, WorkplaceSearch::Client
- Defined in:
- lib/logstash/plugin_mixins/enterprise_search/manticore_transport.rb
Overview
This module is meant to be included in EnterpriseSearch::Clients subclasses and overrides the default #transport method, changing the HTTP client to Manticore. It also provides common Manticore configurations such as :ssl.
Class Method Summary collapse
- .included(base) ⇒ Object
-
.load_transport! ⇒ Object
‘elasticsearch-transport` is old, `elastic-transport` is the replacement.
- .use_legacy_transport? ⇒ Boolean
Instance Method Summary collapse
-
#transport ⇒ Object
overrides Elastic::EnterpriseSearch::Client#transport.
Class Method Details
.included(base) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/logstash/plugin_mixins/enterprise_search/manticore_transport.rb', line 6 def self.included(base) load_transport! raise ArgumentError, "`#{base}` must inherit Elastic::EnterpriseSearch::Client" unless base < Elastic::EnterpriseSearch::Client raise ArgumentError, "`#{base}` must respond to :params" unless base.instance_methods.include? :params end |
.load_transport! ⇒ Object
‘elasticsearch-transport` is old, `elastic-transport` is the replacement. LS-core updated `elasticsearch` > 8: github.com/elastic/logstash/pull/17161 Following logic supports both `elasticsearch-transport` and `elastic-transport` gems.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/logstash/plugin_mixins/enterprise_search/manticore_transport.rb', line 16 def self.load_transport! return if @transport_loaded begin require 'elasticsearch/transport/transport/http/manticore' @use_legacy_transport = true rescue LoadError require 'elastic/transport/transport/http/manticore' @use_legacy_transport = false end @transport_loaded = true end |
.use_legacy_transport? ⇒ Boolean
28 29 30 |
# File 'lib/logstash/plugin_mixins/enterprise_search/manticore_transport.rb', line 28 def self.use_legacy_transport? @use_legacy_transport end |
Instance Method Details
#transport ⇒ Object
overrides Elastic::EnterpriseSearch::Client#transport
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/logstash/plugin_mixins/enterprise_search/manticore_transport.rb', line 33 def transport @options[:transport] || transport_klass.new( host: host, log: log, logger: logger, request_timeout: overall_timeout, adapter: @options[:adapter], transport_options: { request: { open_timeout: open_timeout } }, transport_class: manticore_transport_klass, ssl: build_ssl_config, enable_meta_header: @options[:enable_meta_header] || true, trace: !@options[:tracer].nil?, tracer: @options[:tracer] ) end |