logstash-output-elasticsearch_java 2.0.2 → 2.1.1.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Gemfile +1 -1
  4. data/lib/logstash/outputs/elasticsearch_java.rb +37 -386
  5. data/lib/logstash/outputs/elasticsearch_java/protocol.rb +201 -228
  6. data/logstash-output-elasticsearch_java.gemspec +2 -1
  7. data/spec/integration/outputs/elasticsearch/node_spec.rb +0 -25
  8. data/spec/integration/outputs/index_spec.rb +2 -4
  9. data/spec/integration/outputs/retry_spec.rb +24 -14
  10. data/spec/integration/outputs/routing_spec.rb +1 -2
  11. data/spec/integration/outputs/secure_spec.rb +4 -4
  12. data/spec/integration/outputs/templates_spec.rb +13 -11
  13. data/spec/integration/outputs/transport_create_spec.rb +5 -6
  14. data/spec/integration/outputs/update_spec.rb +5 -6
  15. data/spec/unit/outputs/elasticsearch/protocol_spec.rb +6 -3
  16. data/spec/unit/outputs/elasticsearch_spec.rb +0 -1
  17. data/vendor/jar-dependencies/runtime-jars/{elasticsearch-2.0.0.jar → elasticsearch-2.1.0.jar} +0 -0
  18. data/vendor/jar-dependencies/runtime-jars/jackson-core-2.6.2.jar +0 -0
  19. data/vendor/jar-dependencies/runtime-jars/jackson-dataformat-cbor-2.6.2.jar +0 -0
  20. data/vendor/jar-dependencies/runtime-jars/jackson-dataformat-smile-2.6.2.jar +0 -0
  21. data/vendor/jar-dependencies/runtime-jars/jackson-dataformat-yaml-2.6.2.jar +0 -0
  22. data/vendor/jar-dependencies/runtime-jars/{lucene-analyzers-common-5.2.1.jar → lucene-analyzers-common-5.3.1.jar} +0 -0
  23. data/vendor/jar-dependencies/runtime-jars/{lucene-backward-codecs-5.2.1.jar → lucene-backward-codecs-5.3.1.jar} +0 -0
  24. data/vendor/jar-dependencies/runtime-jars/{lucene-core-5.2.1.jar → lucene-core-5.3.1.jar} +0 -0
  25. data/vendor/jar-dependencies/runtime-jars/{lucene-expressions-5.2.1.jar → lucene-expressions-5.3.1.jar} +0 -0
  26. data/vendor/jar-dependencies/runtime-jars/{lucene-grouping-5.2.1.jar → lucene-grouping-5.3.1.jar} +0 -0
  27. data/vendor/jar-dependencies/runtime-jars/{lucene-highlighter-5.2.1.jar → lucene-highlighter-5.3.1.jar} +0 -0
  28. data/vendor/jar-dependencies/runtime-jars/lucene-join-5.3.1.jar +0 -0
  29. data/vendor/jar-dependencies/runtime-jars/lucene-memory-5.3.1.jar +0 -0
  30. data/vendor/jar-dependencies/runtime-jars/{lucene-misc-5.2.1.jar → lucene-misc-5.3.1.jar} +0 -0
  31. data/vendor/jar-dependencies/runtime-jars/{lucene-queries-5.2.1.jar → lucene-queries-5.3.1.jar} +0 -0
  32. data/vendor/jar-dependencies/runtime-jars/{lucene-queryparser-5.2.1.jar → lucene-queryparser-5.3.1.jar} +0 -0
  33. data/vendor/jar-dependencies/runtime-jars/lucene-sandbox-5.3.1.jar +0 -0
  34. data/vendor/jar-dependencies/runtime-jars/{lucene-spatial-5.2.1.jar → lucene-spatial-5.3.1.jar} +0 -0
  35. data/vendor/jar-dependencies/runtime-jars/lucene-spatial3d-5.3.1.jar +0 -0
  36. data/vendor/jar-dependencies/runtime-jars/lucene-suggest-5.3.1.jar +0 -0
  37. data/vendor/jar-dependencies/runtime-jars/snakeyaml-1.15.jar +0 -0
  38. data/vendor/jar-dependencies/runtime-jars/spatial4j-0.5.jar +0 -0
  39. metadata +105 -91
  40. data/lib/logstash/outputs/elasticsearch_java/elasticsearch-template.json +0 -93
  41. data/vendor/jar-dependencies/runtime-jars/jackson-core-2.5.3.jar +0 -0
  42. data/vendor/jar-dependencies/runtime-jars/jackson-dataformat-cbor-2.5.3.jar +0 -0
  43. data/vendor/jar-dependencies/runtime-jars/jackson-dataformat-smile-2.5.3.jar +0 -0
  44. data/vendor/jar-dependencies/runtime-jars/jackson-dataformat-yaml-2.5.3.jar +0 -0
  45. data/vendor/jar-dependencies/runtime-jars/lucene-join-5.2.1.jar +0 -0
  46. data/vendor/jar-dependencies/runtime-jars/lucene-memory-5.2.1.jar +0 -0
  47. data/vendor/jar-dependencies/runtime-jars/lucene-sandbox-5.2.1.jar +0 -0
  48. data/vendor/jar-dependencies/runtime-jars/lucene-suggest-5.2.1.jar +0 -0
  49. data/vendor/jar-dependencies/runtime-jars/snakeyaml-1.12.jar +0 -0
  50. data/vendor/jar-dependencies/runtime-jars/spatial4j-0.4.1.jar +0 -0
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch_java'
3
- s.version = '2.0.2'
3
+ s.version = '2.1.1.beta1'
4
4
  s.licenses = ['apache-2.0']
5
5
  s.summary = "Logstash Output to Elasticsearch using Java node/transport client"
6
6
  s.description = "Output events to elasticsearch using the java client"
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_runtime_dependency 'stud', ['>= 0.0.17', '~> 0.0']
25
25
  s.add_runtime_dependency 'cabin', ['~> 0.6']
26
26
  s.add_runtime_dependency "logstash-core", ">= 2.0.0.beta2", "< 3.0.0"
27
+ s.add_runtime_dependency "logstash-output-elasticsearch", ">= 2.1.4"
27
28
 
28
29
  s.add_development_dependency 'ftw', '~> 0.0.42'
29
30
  s.add_development_dependency 'logstash-input-generator'
@@ -7,30 +7,5 @@ describe "elasticsearch node client", :integration => true do
7
7
 
8
8
  subject { LogStash::Outputs::ElasticSearchJavaPlugins::Protocols::NodeClient }
9
9
 
10
- it "should support hosts in both string and array" do
11
- # Because we defined *hosts* method in NodeClient as private,
12
- # we use *obj.send :method,[args...]* to call method *hosts*
13
10
 
14
- # Node client should support host in string
15
- # Case 1: default :hosts in string
16
- insist { subject.send :hosts, :hosts => "host",:port => 9300 } == "host:9300"
17
- # Case 2: :port =~ /^\d+_\d+$/
18
- insist { subject.send :hosts, :hosts => "host",:port => "9300-9302"} == "host:9300,host:9301,host:9302"
19
- # Case 3: :hosts =~ /^.+:.+$/
20
- insist { subject.send :hosts, :hosts=> "host:9303",:port => 9300 } == "host:9303"
21
- # Case 4: :hosts=~ /^.+:.+$/ and :port =~ /^\d+_\d+$/
22
- insist { subject.send :hosts, :hosts => "host:9303",:port => "9300-9302"} == "host:9303"
23
-
24
- # Node client should support host in array
25
- # Case 5: :hosts in array with single item
26
- insist { subject.send :hosts, :hosts => ["host"],:port => 9300 } == ("host:9300")
27
- # Case 6: :hostsin array with more than one items
28
- insist { subject.send :hosts, :hosts=> ["host1","host2"],:port => 9300 } == "host1:9300,host2:9300"
29
- # Case 7: :hostsin array with more than one items and :port =~ /^\d+_\d+$/
30
- insist { subject.send :hosts, :hosts=> ["host1","host2"],:port => "9300-9302" } == "host1:9300,host1:9301,host1:9302,host2:9300,host2:9301,host2:9302"
31
- # Case 8: :hostsin array with more than one items and some :hosts=~ /^.+:.+$/
32
- insist { subject.send :hosts, :hosts=> ["host1","host2:9303"],:port => 9300 } == "host1:9300,host2:9303"
33
- # Case 9: :hostsin array with more than one items, :port =~ /^\d+_\d+$/ and some :hosts=~ /^.+:.+$/
34
- insist { subject.send :hosts, :hosts => ["host1","host2:9303"],:port => "9300-9302" } == "host1:9300,host1:9301,host1:9302,host2:9303"
35
- end
36
11
  end
@@ -52,9 +52,8 @@ describe "an indexer with custom index_type", :integration => true do
52
52
  }
53
53
  output {
54
54
  elasticsearch_java {
55
- hosts => "#{get_host()}"
55
+ hosts => "#{get_host()}:#{get_port('transport')}"
56
56
  network_host => "#{get_local_host}"
57
- port => "#{get_port('transport')}"
58
57
  protocol => "transport"
59
58
  index => "#{index}"
60
59
  flush_size => #{flush_size}
@@ -78,9 +77,8 @@ describe "an indexer with no type value set (default to logs)", :integration =>
78
77
  }
79
78
  output {
80
79
  elasticsearch_java {
81
- hosts => "#{get_host()}"
80
+ hosts => "#{get_host()}:#{get_port('transport')}"
82
81
  network_host => "#{get_local_host}"
83
- port => "#{get_port('transport')}"
84
82
  protocol => "transport"
85
83
  index => "#{index}"
86
84
  flush_size => #{flush_size}
@@ -12,9 +12,19 @@ describe "failures in bulk class expected behavior", :integration => true do
12
12
  let(:max_retries) { 3 }
13
13
 
14
14
  def mock_actions_with_response(*resp)
15
- allow_any_instance_of(LogStash::Outputs::ElasticSearchJavaPlugins::Protocols::NodeClient).to receive(:bulk).and_return(*resp)
16
- end
15
+ expanded_responses = resp.map do |resp|
16
+ items = resp["statuses"] && resp["statuses"].map do |status|
17
+ {"create" => {"status" => status, "error" => "Error for #{status}"}}
18
+ end
19
+
20
+ {
21
+ "errors" => resp["errors"],
22
+ "items" => items
23
+ }
24
+ end
17
25
 
26
+ allow_any_instance_of(LogStash::Outputs::ElasticSearchJavaPlugins::Protocols::NodeClient).to receive(:bulk).and_return(*expanded_responses)
27
+ end
18
28
 
19
29
  subject! do
20
30
  settings = {
@@ -23,8 +33,7 @@ describe "failures in bulk class expected behavior", :integration => true do
23
33
  "template_overwrite" => true,
24
34
  "network_host" => get_local_host,
25
35
  "protocol" => 'transport',
26
- "hosts" => get_host(),
27
- "port" => get_port('transport'),
36
+ "hosts" => "#{get_host()}:#{get_port('transport')}",
28
37
  "retry_max_items" => 10,
29
38
  "retry_max_interval" => 1,
30
39
  "max_retries" => max_retries
@@ -46,22 +55,24 @@ describe "failures in bulk class expected behavior", :integration => true do
46
55
  subject.register
47
56
  subject.receive(event1)
48
57
  subject.receive(event2)
49
- subject.buffer_flush(:final => true)
58
+ subject.flush
50
59
  sleep(2)
51
60
  end
52
61
 
53
- it "should raise exception and be retried by stud::buffer" do
62
+ it "retry exceptions within the submit body" do
54
63
  call_count = 0
55
- expect(subject).to receive(:submit).with([action1]).exactly(3).times do
64
+ subject.register
65
+
66
+ expect(subject.client).to receive(:bulk).with(anything).exactly(3).times do
56
67
  if (call_count += 1) <= 2
57
68
  raise "error first two times"
58
69
  else
59
70
  {"errors" => false}
60
71
  end
61
72
  end
62
- subject.register
73
+
63
74
  subject.receive(event1)
64
- subject.close
75
+ subject.flush
65
76
  end
66
77
 
67
78
  it "should retry actions with response status of 503" do
@@ -77,7 +88,7 @@ describe "failures in bulk class expected behavior", :integration => true do
77
88
  subject.receive(event1)
78
89
  subject.receive(event1)
79
90
  subject.receive(event2)
80
- subject.buffer_flush(:final => true)
91
+ subject.flush
81
92
  sleep(3)
82
93
  end
83
94
 
@@ -87,7 +98,7 @@ describe "failures in bulk class expected behavior", :integration => true do
87
98
  expect(subject).to receive(:submit).with([action1]).twice.and_call_original
88
99
  subject.register
89
100
  subject.receive(event1)
90
- subject.buffer_flush(:final => true)
101
+ subject.flush
91
102
  sleep(3)
92
103
  end
93
104
 
@@ -101,7 +112,7 @@ describe "failures in bulk class expected behavior", :integration => true do
101
112
  expect(subject).to receive(:submit).with([action1]).exactly(max_retries+1).times.and_call_original
102
113
  subject.register
103
114
  subject.receive(event1)
104
- subject.buffer_flush(:final => true)
115
+ subject.flush
105
116
  sleep(5)
106
117
  end
107
118
 
@@ -122,9 +133,8 @@ describe "failures in bulk class expected behavior", :integration => true do
122
133
  it "successful requests should not be appended to retry queue" do
123
134
  subject.register
124
135
  subject.receive(event1)
125
- expect(subject).not_to receive(:retry_push)
136
+ expect(subject).to receive(:submit).once.and_call_original
126
137
  subject.close
127
-
128
138
  @es.indices.refresh
129
139
  sleep(5)
130
140
  Stud::try(10.times) do
@@ -46,8 +46,7 @@ describe "(transport protocol) index events with fieldref in routing value", :in
46
46
  }
47
47
  output {
48
48
  elasticsearch_java {
49
- hosts => "#{get_host()}"
50
- port => "#{get_port('transport')}"
49
+ hosts => "#{get_host()}:#{get_port('transport')}"
51
50
  protocol => "transport"
52
51
  index => "#{index}"
53
52
  flush_size => #{flush_size}
@@ -26,7 +26,7 @@ describe "send messages to ElasticSearch using HTTPS", :elasticsearch_secure =>
26
26
  it "sends events to ES" do
27
27
  expect {
28
28
  subject.receive(LogStash::Event.new("message" => "sample message here"))
29
- subject.buffer_flush(:final => true)
29
+ subject.flush
30
30
  }.to_not raise_error
31
31
  end
32
32
  end
@@ -51,7 +51,7 @@ describe "connect using HTTP Authentication", :elasticsearch_secure => true do
51
51
  it "sends events to ES" do
52
52
  expect {
53
53
  subject.receive(LogStash::Event.new("message" => "sample message here"))
54
- subject.buffer_flush(:final => true)
54
+ subject.flush
55
55
  }.to_not raise_error
56
56
  end
57
57
  end
@@ -82,7 +82,7 @@ describe "send messages to ElasticSearch using HTTPS", :elasticsearch_secure =>
82
82
  it "sends events to ES" do
83
83
  expect {
84
84
  subject.receive(LogStash::Event.new("message" => "sample message here"))
85
- subject.buffer_flush(:final => true)
85
+ subject.flush
86
86
  }.to_not raise_error
87
87
  end
88
88
  end
@@ -107,7 +107,7 @@ describe "connect using HTTP Authentication", :elasticsearch_secure => true do
107
107
  it "sends events to ES" do
108
108
  expect {
109
109
  subject.receive(LogStash::Event.new("message" => "sample message here"))
110
- subject.buffer_flush(:final => true)
110
+ subject.flush
111
111
  }.to_not raise_error
112
112
  end
113
113
  end
@@ -10,8 +10,7 @@ describe "index template expected behavior", :integration => true do
10
10
  "manage_template" => true,
11
11
  "template_overwrite" => true,
12
12
  "protocol" => protocol,
13
- "hosts" => "#{get_host()}",
14
- "port" => "#{get_port('transport')}",
13
+ "hosts" => "#{get_host()}:#{get_port('transport')}",
15
14
  "network_host" => get_local_host
16
15
  }
17
16
  next LogStash::Outputs::ElasticSearchJava.new(settings)
@@ -30,14 +29,17 @@ describe "index template expected behavior", :integration => true do
30
29
 
31
30
  subject.register
32
31
 
33
- subject.receive(LogStash::Event.new("message" => "sample message here"))
34
- subject.receive(LogStash::Event.new("somevalue" => 100))
35
- subject.receive(LogStash::Event.new("somevalue" => 10))
36
- subject.receive(LogStash::Event.new("somevalue" => 1))
37
- subject.receive(LogStash::Event.new("country" => "us"))
38
- subject.receive(LogStash::Event.new("country" => "at"))
39
- subject.receive(LogStash::Event.new("geoip" => { "location" => [ 0.0, 0.0 ] }))
40
- subject.buffer_flush(:final => true)
32
+ events = [
33
+ LogStash::Event.new("message" => "sample message here"),
34
+ LogStash::Event.new("somevalue" => 100),
35
+ LogStash::Event.new("somevalue" => 10),
36
+ LogStash::Event.new("somevalue" => 1),
37
+ LogStash::Event.new("country" => "us"),
38
+ LogStash::Event.new("country" => "at"),
39
+ LogStash::Event.new("geoip" => { "location" => [ 0.0, 0.0 ] })
40
+ ]
41
+ subject.multi_receive(events)
42
+
41
43
  @es.indices.refresh
42
44
 
43
45
  # Wait or fail until everything's indexed.
@@ -85,7 +87,7 @@ describe "index template expected behavior", :integration => true do
85
87
  end
86
88
 
87
89
  it "should index stopwords like 'at' " do
88
- results = @es.search(:body => { "aggregations" => { "my_agg" => { "terms" => { "field" => "country" } } } })["aggregations"]["my_agg"]
90
+ results = @es.search(:body => { "aggregations" => { "my_agg" => { "terms" => { "field" => "country.raw" } } } })["aggregations"]["my_agg"]
89
91
  terms = results["buckets"].collect { |b| b["key"] }
90
92
 
91
93
  insist { terms }.include?("us")
@@ -10,8 +10,7 @@ describe "transport client create actions", :integration => true do
10
10
  "index" => "logstash-create",
11
11
  "template_overwrite" => true,
12
12
  "protocol" => "transport",
13
- "hosts" => get_host(),
14
- "port" => get_port('transport'),
13
+ "hosts" => "#{get_host()}:#{get_port('transport')}",
15
14
  "action" => action,
16
15
  "network_host" => get_local_host
17
16
  }
@@ -39,7 +38,7 @@ describe "transport client create actions", :integration => true do
39
38
  subject = get_es_output("create", "id123")
40
39
  subject.register
41
40
  subject.receive(LogStash::Event.new("message" => "sample message here"))
42
- subject.buffer_flush(:final => true)
41
+ subject.flush
43
42
  @es.indices.refresh
44
43
  # Wait or fail until everything's indexed.
45
44
  Stud::try(3.times) do
@@ -52,7 +51,7 @@ describe "transport client create actions", :integration => true do
52
51
  subject = get_es_output("create")
53
52
  subject.register
54
53
  subject.receive(LogStash::Event.new("message" => "sample message here"))
55
- subject.buffer_flush(:final => true)
54
+ subject.flush
56
55
  @es.indices.refresh
57
56
  # Wait or fail until everything's indexed.
58
57
  Stud::try(3.times) do
@@ -67,7 +66,7 @@ describe "transport client create actions", :integration => true do
67
66
  subject = get_es_output("create_unless_exists", "id123")
68
67
  subject.register
69
68
  subject.receive(LogStash::Event.new("message" => "sample message here"))
70
- subject.buffer_flush(:final => true)
69
+ subject.flush
71
70
  @es.indices.refresh
72
71
  # Wait or fail until everything's indexed.
73
72
  Stud::try(3.times) do
@@ -89,7 +88,7 @@ describe "transport client create actions", :integration => true do
89
88
  subject.register
90
89
  subject.receive(LogStash::Event.new("message" => "sample message here"))
91
90
  subject.receive(LogStash::Event.new("message" => "sample message here")) # 400 status failure (same id)
92
- subject.buffer_flush(:final => true)
91
+ subject.flush
93
92
  @es.indices.refresh
94
93
  # Wait or fail until everything's indexed.
95
94
  Stud::try(3.times) do
@@ -10,8 +10,7 @@ describe "all protocols update actions", :integration => true do
10
10
  "index" => "logstash-update",
11
11
  "template_overwrite" => true,
12
12
  "protocol" => protocol,
13
- "hosts" => get_host(),
14
- "port" => get_port(protocol),
13
+ "hosts" => "#{get_host()}:#{get_port(protocol)}",
15
14
  "network_host" => get_local_host,
16
15
  "action" => "update"
17
16
  }
@@ -52,7 +51,7 @@ describe "all protocols update actions", :integration => true do
52
51
  subject = get_es_output(protocol, "456")
53
52
  subject.register
54
53
  subject.receive(LogStash::Event.new("message" => "sample message here"))
55
- subject.buffer_flush(:final => true)
54
+ subject.flush
56
55
  expect {@es.get(:index => 'logstash-update', :type => 'logs', :id => "456", :refresh => true)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
57
56
  end
58
57
 
@@ -60,7 +59,7 @@ describe "all protocols update actions", :integration => true do
60
59
  subject = get_es_output(protocol, "123")
61
60
  subject.register
62
61
  subject.receive(LogStash::Event.new("message" => "updated message here"))
63
- subject.buffer_flush(:final => true)
62
+ subject.flush
64
63
  r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "123", :refresh => true)
65
64
  insist { r["_source"]["message"] } == 'updated message here'
66
65
  end
@@ -71,7 +70,7 @@ describe "all protocols update actions", :integration => true do
71
70
  subject = get_es_output(protocol, "456", '{"message": "upsert message"}')
72
71
  subject.register
73
72
  subject.receive(LogStash::Event.new("message" => "sample message here"))
74
- subject.buffer_flush(:final => true)
73
+ subject.flush
75
74
  r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "456", :refresh => true)
76
75
  insist { r["_source"]["message"] } == 'upsert message'
77
76
  end
@@ -80,7 +79,7 @@ describe "all protocols update actions", :integration => true do
80
79
  subject = get_es_output(protocol, "456", nil, true)
81
80
  subject.register
82
81
  subject.receive(LogStash::Event.new("message" => "sample message here"))
83
- subject.buffer_flush(:final => true)
82
+ subject.flush
84
83
  r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "456", :refresh => true)
85
84
  insist { r["_source"]["message"] } == 'sample message here'
86
85
  end
@@ -3,6 +3,8 @@ require "logstash/outputs/elasticsearch_java/protocol"
3
3
  require "java"
4
4
 
5
5
  describe LogStash::Outputs::ElasticSearchJavaPlugins::Protocols::NodeClient do
6
+ subject { LogStash::Outputs::ElasticSearchJavaPlugins::Protocols::NodeClient.new() }
7
+
6
8
  context "successful" do
7
9
  it "should map correctly" do
8
10
  index_response = org.elasticsearch.action.index.IndexResponse.new("my_index", "my_type", "my_id", 123, true)
@@ -12,7 +14,7 @@ describe LogStash::Outputs::ElasticSearchJavaPlugins::Protocols::NodeClient do
12
14
  bulk_item_response_update = org.elasticsearch.action.bulk.BulkItemResponse.new(32, "update", update_response)
13
15
  bulk_item_response_delete = org.elasticsearch.action.bulk.BulkItemResponse.new(32, "delete", delete_response)
14
16
  bulk_response = org.elasticsearch.action.bulk.BulkResponse.new([bulk_item_response_index, bulk_item_response_update, bulk_item_response_delete], 0)
15
- ret = LogStash::Outputs::ElasticSearchJavaPlugins::Protocols::NodeClient.normalize_bulk_response(bulk_response)
17
+ ret = subject.normalize_bulk_response(bulk_response)
16
18
  insist { ret } == {"errors" => false}
17
19
  end
18
20
  end
@@ -24,8 +26,9 @@ describe LogStash::Outputs::ElasticSearchJavaPlugins::Protocols::NodeClient do
24
26
  bulk_item_response_update = org.elasticsearch.action.bulk.BulkItemResponse.new(32, "update", failure)
25
27
  bulk_item_response_delete = org.elasticsearch.action.bulk.BulkItemResponse.new(32, "delete", failure)
26
28
  bulk_response = org.elasticsearch.action.bulk.BulkResponse.new([bulk_item_response_index, bulk_item_response_update, bulk_item_response_delete], 0)
27
- actual = LogStash::Outputs::ElasticSearchJavaPlugins::Protocols::NodeClient.normalize_bulk_response(bulk_response)
28
- insist { actual } == {"errors" => true, "statuses" => [400, 400, 400]}
29
+ actual = subject.normalize_bulk_response(bulk_response)
30
+ expect(actual["errors"]).to eql(true)
31
+ expect(actual["items"].map {|i| i.first[1]["status"]}).to eql([400,400,400])
29
32
  end
30
33
  end
31
34
  end
@@ -28,7 +28,6 @@ describe "outputs/elasticsearch_java" do
28
28
  it "should set host to localhost" do
29
29
  expect(LogStash::Outputs::ElasticSearchJavaPlugins::Protocols::TransportClient).to receive(:new).with({
30
30
  :hosts => ["127.0.0.1"],
31
- :port => "9300-9305",
32
31
  :protocol => "transport",
33
32
  :client_settings => {
34
33
  "client.transport.sniff" => false,
metadata CHANGED
@@ -1,170 +1,191 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-elasticsearch_java
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.1.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-18 00:00:00.000000000 Z
11
+ date: 2015-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
14
19
  name: concurrent-ruby
20
+ prerelease: false
21
+ type: :runtime
15
22
  version_requirements: !ruby/object:Gem::Requirement
16
23
  requirements:
17
- - - '>='
24
+ - - ">="
18
25
  - !ruby/object:Gem::Version
19
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
20
28
  requirement: !ruby/object:Gem::Requirement
21
29
  requirements:
22
- - - '>='
30
+ - - ">="
23
31
  - !ruby/object:Gem::Version
24
- version: '0'
32
+ version: 1.0.13
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: '1.0'
36
+ name: elasticsearch
25
37
  prerelease: false
26
38
  type: :runtime
27
- - !ruby/object:Gem::Dependency
28
- name: elasticsearch
29
39
  version_requirements: !ruby/object:Gem::Requirement
30
40
  requirements:
31
- - - '>='
41
+ - - ">="
32
42
  - !ruby/object:Gem::Version
33
43
  version: 1.0.13
34
- - - ~>
44
+ - - "~>"
35
45
  - !ruby/object:Gem::Version
36
46
  version: '1.0'
47
+ - !ruby/object:Gem::Dependency
37
48
  requirement: !ruby/object:Gem::Requirement
38
49
  requirements:
39
- - - '>='
50
+ - - ">="
40
51
  - !ruby/object:Gem::Version
41
- version: 1.0.13
42
- - - ~>
52
+ version: 0.0.17
53
+ - - "~>"
43
54
  - !ruby/object:Gem::Version
44
- version: '1.0'
55
+ version: '0.0'
56
+ name: stud
45
57
  prerelease: false
46
58
  type: :runtime
47
- - !ruby/object:Gem::Dependency
48
- name: stud
49
59
  version_requirements: !ruby/object:Gem::Requirement
50
60
  requirements:
51
- - - '>='
61
+ - - ">="
52
62
  - !ruby/object:Gem::Version
53
63
  version: 0.0.17
54
- - - ~>
64
+ - - "~>"
55
65
  - !ruby/object:Gem::Version
56
66
  version: '0.0'
67
+ - !ruby/object:Gem::Dependency
57
68
  requirement: !ruby/object:Gem::Requirement
58
69
  requirements:
59
- - - '>='
60
- - !ruby/object:Gem::Version
61
- version: 0.0.17
62
- - - ~>
70
+ - - "~>"
63
71
  - !ruby/object:Gem::Version
64
- version: '0.0'
72
+ version: '0.6'
73
+ name: cabin
65
74
  prerelease: false
66
75
  type: :runtime
67
- - !ruby/object:Gem::Dependency
68
- name: cabin
69
76
  version_requirements: !ruby/object:Gem::Requirement
70
77
  requirements:
71
- - - ~>
78
+ - - "~>"
72
79
  - !ruby/object:Gem::Version
73
80
  version: '0.6'
81
+ - !ruby/object:Gem::Dependency
74
82
  requirement: !ruby/object:Gem::Requirement
75
83
  requirements:
76
- - - ~>
84
+ - - ">="
77
85
  - !ruby/object:Gem::Version
78
- version: '0.6'
86
+ version: 2.0.0.beta2
87
+ - - "<"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.0.0
90
+ name: logstash-core
79
91
  prerelease: false
80
92
  type: :runtime
81
- - !ruby/object:Gem::Dependency
82
- name: logstash-core
83
93
  version_requirements: !ruby/object:Gem::Requirement
84
94
  requirements:
85
- - - '>='
95
+ - - ">="
86
96
  - !ruby/object:Gem::Version
87
97
  version: 2.0.0.beta2
88
- - - <
98
+ - - "<"
89
99
  - !ruby/object:Gem::Version
90
100
  version: 3.0.0
101
+ - !ruby/object:Gem::Dependency
91
102
  requirement: !ruby/object:Gem::Requirement
92
103
  requirements:
93
- - - '>='
104
+ - - ">="
94
105
  - !ruby/object:Gem::Version
95
- version: 2.0.0.beta2
96
- - - <
97
- - !ruby/object:Gem::Version
98
- version: 3.0.0
106
+ version: 2.1.4
107
+ name: logstash-output-elasticsearch
99
108
  prerelease: false
100
109
  type: :runtime
101
- - !ruby/object:Gem::Dependency
102
- name: ftw
103
110
  version_requirements: !ruby/object:Gem::Requirement
104
111
  requirements:
105
- - - ~>
112
+ - - ">="
106
113
  - !ruby/object:Gem::Version
107
- version: 0.0.42
114
+ version: 2.1.4
115
+ - !ruby/object:Gem::Dependency
108
116
  requirement: !ruby/object:Gem::Requirement
109
117
  requirements:
110
- - - ~>
118
+ - - "~>"
111
119
  - !ruby/object:Gem::Version
112
120
  version: 0.0.42
121
+ name: ftw
113
122
  prerelease: false
114
123
  type: :development
115
- - !ruby/object:Gem::Dependency
116
- name: logstash-input-generator
117
124
  version_requirements: !ruby/object:Gem::Requirement
118
125
  requirements:
119
- - - '>='
126
+ - - "~>"
120
127
  - !ruby/object:Gem::Version
121
- version: '0'
128
+ version: 0.0.42
129
+ - !ruby/object:Gem::Dependency
122
130
  requirement: !ruby/object:Gem::Requirement
123
131
  requirements:
124
- - - '>='
132
+ - - ">="
125
133
  - !ruby/object:Gem::Version
126
134
  version: '0'
135
+ name: logstash-input-generator
127
136
  prerelease: false
128
137
  type: :development
129
- - !ruby/object:Gem::Dependency
130
- name: logstash-devutils
131
138
  version_requirements: !ruby/object:Gem::Requirement
132
139
  requirements:
133
- - - '>='
140
+ - - ">="
134
141
  - !ruby/object:Gem::Version
135
142
  version: '0'
143
+ - !ruby/object:Gem::Dependency
136
144
  requirement: !ruby/object:Gem::Requirement
137
145
  requirements:
138
- - - '>='
146
+ - - ">="
139
147
  - !ruby/object:Gem::Version
140
148
  version: '0'
149
+ name: logstash-devutils
141
150
  prerelease: false
142
151
  type: :development
143
- - !ruby/object:Gem::Dependency
144
- name: longshoreman
145
152
  version_requirements: !ruby/object:Gem::Requirement
146
153
  requirements:
147
- - - '>='
154
+ - - ">="
148
155
  - !ruby/object:Gem::Version
149
156
  version: '0'
157
+ - !ruby/object:Gem::Dependency
150
158
  requirement: !ruby/object:Gem::Requirement
151
159
  requirements:
152
- - - '>='
160
+ - - ">="
153
161
  - !ruby/object:Gem::Version
154
162
  version: '0'
163
+ name: longshoreman
155
164
  prerelease: false
156
165
  type: :development
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
157
171
  description: Output events to elasticsearch using the java client
158
172
  email: info@elastic.co
159
173
  executables: []
160
174
  extensions: []
161
175
  extra_rdoc_files: []
162
176
  files:
177
+ - CHANGELOG.md
178
+ - CONTRIBUTORS
179
+ - Gemfile
180
+ - LICENSE
181
+ - NOTICE.TXT
182
+ - README.md
163
183
  - lib/logstash-output-elasticsearch_java_jars.rb
164
184
  - lib/logstash/outputs/elasticsearch_java.rb
165
- - lib/logstash/outputs/elasticsearch_java/elasticsearch-template.json
166
185
  - lib/logstash/outputs/elasticsearch_java/protocol.rb
186
+ - logstash-output-elasticsearch_java.gemspec
167
187
  - spec/es_spec_helper.rb
188
+ - spec/integration/outputs/elasticsearch/node_spec.rb
168
189
  - spec/integration/outputs/index_spec.rb
169
190
  - spec/integration/outputs/retry_spec.rb
170
191
  - spec/integration/outputs/routing_spec.rb
@@ -172,9 +193,8 @@ files:
172
193
  - spec/integration/outputs/templates_spec.rb
173
194
  - spec/integration/outputs/transport_create_spec.rb
174
195
  - spec/integration/outputs/update_spec.rb
175
- - spec/integration/outputs/elasticsearch/node_spec.rb
176
- - spec/unit/outputs/elasticsearch_spec.rb
177
196
  - spec/unit/outputs/elasticsearch/protocol_spec.rb
197
+ - spec/unit/outputs/elasticsearch_spec.rb
178
198
  - vendor/jar-dependencies/runtime-jars/HdrHistogram-2.1.6.jar
179
199
  - vendor/jar-dependencies/runtime-jars/antlr-runtime-3.5.jar
180
200
  - vendor/jar-dependencies/runtime-jars/apache-log4j-extras-1.2.17.jar
@@ -183,45 +203,39 @@ files:
183
203
  - vendor/jar-dependencies/runtime-jars/commons-cli-1.3.1.jar
184
204
  - vendor/jar-dependencies/runtime-jars/compiler-0.8.13.jar
185
205
  - vendor/jar-dependencies/runtime-jars/compress-lzf-1.0.2.jar
186
- - vendor/jar-dependencies/runtime-jars/elasticsearch-2.0.0.jar
206
+ - vendor/jar-dependencies/runtime-jars/elasticsearch-2.1.0.jar
187
207
  - vendor/jar-dependencies/runtime-jars/groovy-all-2.4.4-indy.jar
188
208
  - vendor/jar-dependencies/runtime-jars/guava-18.0.jar
189
209
  - vendor/jar-dependencies/runtime-jars/hppc-0.7.1.jar
190
- - vendor/jar-dependencies/runtime-jars/jackson-core-2.5.3.jar
191
- - vendor/jar-dependencies/runtime-jars/jackson-dataformat-cbor-2.5.3.jar
192
- - vendor/jar-dependencies/runtime-jars/jackson-dataformat-smile-2.5.3.jar
193
- - vendor/jar-dependencies/runtime-jars/jackson-dataformat-yaml-2.5.3.jar
210
+ - vendor/jar-dependencies/runtime-jars/jackson-core-2.6.2.jar
211
+ - vendor/jar-dependencies/runtime-jars/jackson-dataformat-cbor-2.6.2.jar
212
+ - vendor/jar-dependencies/runtime-jars/jackson-dataformat-smile-2.6.2.jar
213
+ - vendor/jar-dependencies/runtime-jars/jackson-dataformat-yaml-2.6.2.jar
194
214
  - vendor/jar-dependencies/runtime-jars/jna-4.1.0.jar
195
215
  - vendor/jar-dependencies/runtime-jars/joda-convert-1.2.jar
196
216
  - vendor/jar-dependencies/runtime-jars/joda-time-2.8.2.jar
197
217
  - vendor/jar-dependencies/runtime-jars/jsr166e-1.1.0.jar
198
218
  - vendor/jar-dependencies/runtime-jars/jts-1.13.jar
199
219
  - vendor/jar-dependencies/runtime-jars/log4j-1.2.17.jar
200
- - vendor/jar-dependencies/runtime-jars/lucene-analyzers-common-5.2.1.jar
201
- - vendor/jar-dependencies/runtime-jars/lucene-backward-codecs-5.2.1.jar
202
- - vendor/jar-dependencies/runtime-jars/lucene-core-5.2.1.jar
203
- - vendor/jar-dependencies/runtime-jars/lucene-expressions-5.2.1.jar
204
- - vendor/jar-dependencies/runtime-jars/lucene-grouping-5.2.1.jar
205
- - vendor/jar-dependencies/runtime-jars/lucene-highlighter-5.2.1.jar
206
- - vendor/jar-dependencies/runtime-jars/lucene-join-5.2.1.jar
207
- - vendor/jar-dependencies/runtime-jars/lucene-memory-5.2.1.jar
208
- - vendor/jar-dependencies/runtime-jars/lucene-misc-5.2.1.jar
209
- - vendor/jar-dependencies/runtime-jars/lucene-queries-5.2.1.jar
210
- - vendor/jar-dependencies/runtime-jars/lucene-queryparser-5.2.1.jar
211
- - vendor/jar-dependencies/runtime-jars/lucene-sandbox-5.2.1.jar
212
- - vendor/jar-dependencies/runtime-jars/lucene-spatial-5.2.1.jar
213
- - vendor/jar-dependencies/runtime-jars/lucene-suggest-5.2.1.jar
220
+ - vendor/jar-dependencies/runtime-jars/lucene-analyzers-common-5.3.1.jar
221
+ - vendor/jar-dependencies/runtime-jars/lucene-backward-codecs-5.3.1.jar
222
+ - vendor/jar-dependencies/runtime-jars/lucene-core-5.3.1.jar
223
+ - vendor/jar-dependencies/runtime-jars/lucene-expressions-5.3.1.jar
224
+ - vendor/jar-dependencies/runtime-jars/lucene-grouping-5.3.1.jar
225
+ - vendor/jar-dependencies/runtime-jars/lucene-highlighter-5.3.1.jar
226
+ - vendor/jar-dependencies/runtime-jars/lucene-join-5.3.1.jar
227
+ - vendor/jar-dependencies/runtime-jars/lucene-memory-5.3.1.jar
228
+ - vendor/jar-dependencies/runtime-jars/lucene-misc-5.3.1.jar
229
+ - vendor/jar-dependencies/runtime-jars/lucene-queries-5.3.1.jar
230
+ - vendor/jar-dependencies/runtime-jars/lucene-queryparser-5.3.1.jar
231
+ - vendor/jar-dependencies/runtime-jars/lucene-sandbox-5.3.1.jar
232
+ - vendor/jar-dependencies/runtime-jars/lucene-spatial-5.3.1.jar
233
+ - vendor/jar-dependencies/runtime-jars/lucene-spatial3d-5.3.1.jar
234
+ - vendor/jar-dependencies/runtime-jars/lucene-suggest-5.3.1.jar
214
235
  - vendor/jar-dependencies/runtime-jars/netty-3.10.5.Final.jar
215
- - vendor/jar-dependencies/runtime-jars/snakeyaml-1.12.jar
216
- - vendor/jar-dependencies/runtime-jars/spatial4j-0.4.1.jar
236
+ - vendor/jar-dependencies/runtime-jars/snakeyaml-1.15.jar
237
+ - vendor/jar-dependencies/runtime-jars/spatial4j-0.5.jar
217
238
  - vendor/jar-dependencies/runtime-jars/t-digest-3.0.jar
218
- - logstash-output-elasticsearch_java.gemspec
219
- - README.md
220
- - CHANGELOG.md
221
- - CONTRIBUTORS
222
- - Gemfile
223
- - LICENSE
224
- - NOTICE.TXT
225
239
  homepage: http://logstash.net/
226
240
  licenses:
227
241
  - apache-2.0
@@ -234,22 +248,23 @@ require_paths:
234
248
  - lib
235
249
  required_ruby_version: !ruby/object:Gem::Requirement
236
250
  requirements:
237
- - - '>='
251
+ - - ">="
238
252
  - !ruby/object:Gem::Version
239
253
  version: '0'
240
254
  required_rubygems_version: !ruby/object:Gem::Requirement
241
255
  requirements:
242
- - - '>='
256
+ - - ">"
243
257
  - !ruby/object:Gem::Version
244
- version: '0'
258
+ version: 1.3.1
245
259
  requirements: []
246
260
  rubyforge_project:
247
- rubygems_version: 2.1.9
261
+ rubygems_version: 2.4.8
248
262
  signing_key:
249
263
  specification_version: 4
250
264
  summary: Logstash Output to Elasticsearch using Java node/transport client
251
265
  test_files:
252
266
  - spec/es_spec_helper.rb
267
+ - spec/integration/outputs/elasticsearch/node_spec.rb
253
268
  - spec/integration/outputs/index_spec.rb
254
269
  - spec/integration/outputs/retry_spec.rb
255
270
  - spec/integration/outputs/routing_spec.rb
@@ -257,6 +272,5 @@ test_files:
257
272
  - spec/integration/outputs/templates_spec.rb
258
273
  - spec/integration/outputs/transport_create_spec.rb
259
274
  - spec/integration/outputs/update_spec.rb
260
- - spec/integration/outputs/elasticsearch/node_spec.rb
261
- - spec/unit/outputs/elasticsearch_spec.rb
262
275
  - spec/unit/outputs/elasticsearch/protocol_spec.rb
276
+ - spec/unit/outputs/elasticsearch_spec.rb