Skip to content

Commit

Permalink
Revert "Use manticore client" because es-ruby supports it poorly
Browse files Browse the repository at this point in the history
Unfortunately the es-ruby client doesn't support its manticore adapter
well, namely in setting content-type, so this reverts that.

This reverts commit 611e74c.
  • Loading branch information
andrewvc committed Feb 7, 2017
1 parent 611e74c commit d79b6ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
## 4.0.1
- Switch internal HTTP client to support TLSv1.2
- Upgrade ES client internally to better support ES 5.x

## 4.0.0
- Remove `scan` from list of options as this is no longer allowed in
Elasticsearch 5.0.
Expand Down
22 changes: 7 additions & 15 deletions lib/logstash/inputs/elasticsearch.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# encoding: utf-8
require "logstash/inputs/base"
require "logstash/namespace"
require 'elasticsearch'
require 'elasticsearch/transport/transport/http/manticore'
require "base64"

# Read from an Elasticsearch cluster, based on search query results.
Expand Down Expand Up @@ -107,6 +105,8 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
config :ca_file, :validate => :path

def register
require "elasticsearch"

@options = {
:index => @index,
:body => @query,
Expand All @@ -117,10 +117,8 @@ def register
transport_options = {}

if @user && @password
transport_options[:auth] = {
:user => @user,
:password => @password.value
}
token = Base64.strict_encode64("#{@user}:#{@password.value}")
transport_options[:headers] = { :Authorization => "Basic #{token}" }
end

hosts = if @ssl then
Expand All @@ -132,17 +130,11 @@ def register
@hosts
end

client_options = {
:hosts => hosts,
:transport_options => transport_options,
:transport_class => Elasticsearch::Transport::Transport::HTTP::Manticore
}

if @ssl && @ca_file
client_options[:ssl] = { :enabled => true, :ca_file => @ca_file }
transport_options[:ssl] = { :ca_file => @ca_file }
end
@client = Elasticsearch::Client.new(client_options)

@client = Elasticsearch::Client.new(:hosts => hosts, :transport_options => transport_options)
end

def run(output_queue)
Expand Down
6 changes: 2 additions & 4 deletions logstash-input-elasticsearch.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|

s.name = 'logstash-input-elasticsearch'
s.version = '4.0.1'
s.version = '4.0.0'
s.licenses = ['Apache License (2.0)']
s.summary = "Read from an Elasticsearch cluster, based on search query results"
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"
Expand All @@ -22,9 +22,7 @@ Gem::Specification.new do |s|
# Gem dependencies
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"

s.add_runtime_dependency 'elasticsearch', ['>= 5.0.0', '< 6.0.0']
s.add_runtime_dependency "manticore", '>= 0.5.4', '< 1.0.0'

s.add_runtime_dependency 'elasticsearch', ['>= 1.0.6', '~> 1.0']

s.add_runtime_dependency 'logstash-codec-json'

Expand Down

0 comments on commit d79b6ad

Please sign in to comment.