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

Instance Method Summary collapse

Class Method Details

.eps_version_7?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/logstash/plugin_mixins/enterprise_search/manticore_transport.rb', line 36

def self.eps_version_7?
  Elastic::EnterpriseSearch::VERSION.start_with?('7')
end

.included(base) ⇒ Object

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
13
14
15
# File 'lib/logstash/plugin_mixins/enterprise_search/manticore_transport.rb', line 6

def self.included(base)
  if eps_version_7?
    require 'elasticsearch/transport/transport/http/manticore'
  else
    require 'elastic/transport/transport/http/manticore'
  end

  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

Instance Method Details

#transportObject

overrides Elastic::EnterpriseSearch::Client#transport



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/logstash/plugin_mixins/enterprise_search/manticore_transport.rb', line 18

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