Skip to content

Patches for 1x #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions lib/logstash/outputs/elasticsearch/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ def safe_bulk(es_actions,actions)
"Attempted to send a bulk request to Elasticsearch configured at '#{@client.client_options[:hosts]}',"+
" but Elasticsearch appears to be unreachable or down!",
:error_message => e.message,
:class => e.class.name,
:client_config => @client.client_options,
:class => e.class.name
)
@logger.debug("Failed actions for last bad bulk request!", :actions => actions)

Expand All @@ -193,8 +192,7 @@ def safe_bulk(es_actions,actions)
"the configuration provided?",
:error_message => e.message,
:error_class => e.class.name,
:backtrace => e.backtrace,
:client_config => @client.client_options,
:backtrace => e.backtrace
)

@logger.debug("Failed actions for last bad bulk request!", :actions => actions)
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/outputs/routing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
before do
subject.register
event_count.times do
subject.receive(LogStash::Event.new("message" => "Hello World!", "type" => type))
subject.receive(LogStash::Event.new("message" => "test", "type" => type))
end
end

Expand Down
4 changes: 1 addition & 3 deletions spec/integration/outputs/templates_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@
end

it "make [geoip][location] a geo_point" do
results = @es.search(:body => { "query" => { "bool" => { "must" => { "match_all" => {} }, "filter" => { "geo_distance" => { "distance" => "1000km", "geoip.location" => { "lat" => 0.5, "lon" => 0.5 } } } } } })
insist { results["hits"]["total"] } == 1
insist { results["hits"]["hits"][0]["_source"]["geoip"]["location"] } == [ 0.0, 0.0 ]
expect(@es.indices.get_template(name: "logstash")["logstash"]["mappings"]["_default_"]["properties"]["geoip"]["properties"]["location"]["type"]).to eq("geo_point")
end

it "aggregate .raw results correctly " do
Expand Down
3 changes: 2 additions & 1 deletion spec/integration/outputs/update_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require_relative "../../../spec/es_spec_helper"

describe "Update actions", :integration => true do
describe "Update actions", :integration => true, :version_2x_plus => true do

require "logstash/outputs/elasticsearch"
require "elasticsearch"

Expand Down
30 changes: 24 additions & 6 deletions travis-run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/bin/bash
set -ex

function finish {
last_result=$?
set +e
[[ $last_result -ne 0 ]] && cat /tmp/elasticsearch.log
}
trap finish EXIT

setup_es() {
download_url=$1
curl -sL $download_url > elasticsearch.tar.gz
Expand All @@ -10,10 +17,17 @@ setup_es() {
}

start_es() {
es_args=$1
elasticsearch/bin/elasticsearch $es_args > /tmp/elasticsearch.log &
sleep 10
curl http://localhost:9200 && echo "ES is up!" || cat /tmp/elasticsearch.log
es_args=$@
elasticsearch/bin/elasticsearch $es_args > /tmp/elasticsearch.log 2>/dev/null &
count=120
echo "Waiting for elasticsearch to respond..."
while ! curl --silent localhost:9200 && [[ $count -ne 0 ]]; do
count=$(( $count - 1 ))
[[ $count -eq 0 ]] && return 1
sleep 1
done
echo "Elasticsearch is Up !"
return 0
}

if [[ "$INTEGRATION" != "true" ]]; then
Expand All @@ -22,10 +36,14 @@ else
if [[ "$ES_VERSION" == 5.* ]]; then
setup_es https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/$ES_VERSION/elasticsearch-$ES_VERSION.tar.gz
start_es -Ees.script.inline=true -Ees.script.indexed=true -Ees.script.file=true
bundle exec rspec -fd spec --tag integration --tag version_5x || cat /tmp/elasticsearch.log
bundle exec rspec -fd spec --tag integration --tag version_5x --tag integration_2x_plus
elif [[ "$ES_VERSION" == 2.* ]]; then
setup_es https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-$ES_VERSION.tar.gz
start_es -Des.script.inline=on -Des.script.indexed=on -Des.script.file=on
bundle exec rspec -fd spec --tag integration --tag ~version_5x
else
setup_es https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-$ES_VERSION.tar.gz
start_es -Des.script.inline=on -Des.script.indexed=on -Des.script.file=on
bundle exec rspec -fd spec --tag integration --tag ~version_5x || cat /tmp/elasticsearch.log
bundle exec rspec -fd spec --tag integration --tag ~version_5x --tag ~version_2x_plus
fi
fi