logstash-output-elasticsearch 9.2.3-java → 9.2.4-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e4f54b01a626097bb553a3955afb9718ba7646c14f08ad0fe0eb89c15162b36
4
- data.tar.gz: 957ae579af4d96853c4be2da24802cf8da56d6277868ed2353696a5aa607b0bf
3
+ metadata.gz: 42465226c4184be1d0a210a70c4baf76219818de876bb05e7223c6e33575cbd3
4
+ data.tar.gz: 4f547ee1a60601b1412fb9adfbb53de1b07bfbc87215e871089c09e7e593dec1
5
5
  SHA512:
6
- metadata.gz: 366093f142db6dcf2db65ca6ca8cf342b67ac2ac61b4a1ba9bd7820701844fb2b950096438354136f7f0d9e67a70e5900b0231864d7e1e804b1705cb155f97b1
7
- data.tar.gz: 1942f02dffe708e9f8bbd2b6ec3c4c134577625ced71012415cb8fcf87e6ffdad7fc5ae53fc0690def17fa2e574719c42ca590a44fdc91ad34b1caf2a017fdc8
6
+ metadata.gz: 2bf8b3f9ffe85bbd63e4456131271f06cad92acc95033cb79c40900b8199ee8795d8267aeb488085d65d0b07de9a9361710906573f76f818ed9f271acea90d06
7
+ data.tar.gz: ddac41655af9d2af7b1d2bf0dff94bcbb497daca068efc7423c3af1ca8cb14b235e8afedf81bc0864a968d1f685039b458c78e1af1b91114135e66e34e8312bf
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 9.2.4
2
+ - Fixed support for Elasticsearch 7.x [#812](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/812)
3
+
1
4
  ## 9.2.3
2
5
  - Tweaked logging statements to reduce verbosity
3
6
 
data/docs/index.asciidoc CHANGED
@@ -96,7 +96,7 @@ happens, the problem is logged as a warning, and the event is dropped. See
96
96
  ==== Batch Sizes
97
97
 
98
98
  This plugin attempts to send batches of events as a single request. However, if
99
- a request exceeds 20MB we will break it up until multiple batch requests. If a single document exceeds 20MB it will be sent as a single request.
99
+ a request exceeds 20MB we will break it up into multiple batch requests. If a single document exceeds 20MB it will be sent as a single request.
100
100
 
101
101
  ==== DNS Caching
102
102
 
@@ -67,7 +67,7 @@ module LogStash; module Outputs; class ElasticSearch;
67
67
  :_id => @document_id ? event.sprintf(@document_id) : nil,
68
68
  :_index => event.sprintf(@index),
69
69
  :_type => get_event_type(event),
70
- :_routing => @routing ? event.sprintf(@routing) : nil
70
+ routing_field_name => @routing ? event.sprintf(@routing) : nil
71
71
  }
72
72
 
73
73
  if @pipeline
@@ -79,7 +79,7 @@ module LogStash; module Outputs; class ElasticSearch;
79
79
  join_value = event.get(@join_field)
80
80
  parent_value = event.sprintf(@parent)
81
81
  event.set(@join_field, { "name" => join_value, "parent" => parent_value })
82
- params[:_routing] = event.sprintf(@parent)
82
+ params[routing_field_name] = event.sprintf(@parent)
83
83
  else
84
84
  params[:parent] = event.sprintf(@parent)
85
85
  end
@@ -88,7 +88,7 @@ module LogStash; module Outputs; class ElasticSearch;
88
88
  if action == 'update'
89
89
  params[:_upsert] = LogStash::Json.load(event.sprintf(@upsert)) if @upsert != ""
90
90
  params[:_script] = event.sprintf(@script) if @script != ""
91
- params[:_retry_on_conflict] = @retry_on_conflict
91
+ params[retry_on_conflict_action_name] = @retry_on_conflict
92
92
  end
93
93
 
94
94
  if @version
@@ -114,6 +114,15 @@ module LogStash; module Outputs; class ElasticSearch;
114
114
  client.maximum_seen_major_version
115
115
  end
116
116
 
117
+
118
+ def routing_field_name
119
+ maximum_seen_major_version >= 6 ? :routing : :_routing
120
+ end
121
+
122
+ def retry_on_conflict_action_name
123
+ maximum_seen_major_version >= 7 ? :retry_on_conflict : :_retry_on_conflict
124
+ end
125
+
117
126
  def install_template
118
127
  TemplateManager.install_template(self)
119
128
  @template_installed.make_true
@@ -170,7 +170,7 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
170
170
  return nil
171
171
  else
172
172
  case major_version(url_meta[:version])
173
- when 5, 6
173
+ when 5, 6, 7
174
174
  sniff_5x_and_above(nodes)
175
175
  when 2, 1
176
176
  sniff_2x_1x(nodes)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch'
3
- s.version = '9.2.3'
3
+ s.version = '9.2.4'
4
4
  s.licenses = ['apache-2.0']
5
5
  s.summary = "Stores logs in Elasticsearch"
6
6
  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"
@@ -11,6 +11,31 @@ module ESHelper
11
11
  Elasticsearch::Client.new(:hosts => [get_host_port])
12
12
  end
13
13
 
14
+ def doc_type
15
+ if ESHelper.es_version_satisfies?(">=7")
16
+ "_doc"
17
+ else
18
+ "doc"
19
+ end
20
+ end
21
+
22
+ def mapping_name
23
+ if ESHelper.es_version_satisfies?(">=7")
24
+ "_doc"
25
+ else
26
+ "_default_"
27
+ end
28
+
29
+ end
30
+
31
+ def routing_field_name
32
+ if ESHelper.es_version_satisfies?(">=6")
33
+ :routing
34
+ else
35
+ :_routing
36
+ end
37
+ end
38
+
14
39
  def self.es_version
15
40
  RSpec.configuration.filter[:es_version] || ENV['ES_VERSION']
16
41
  end
@@ -50,7 +50,7 @@ if ESHelper.es_version_satisfies?(">= 5")
50
50
  result = LogStash::Json.load(response.body)
51
51
  result["hits"]["hits"].each do |doc|
52
52
  if ESHelper.es_version_satisfies?(">= 6")
53
- expect(doc["_type"]).to eq("doc")
53
+ expect(doc["_type"]).to eq(doc_type)
54
54
  else
55
55
  expect(doc["_type"]).to eq(type)
56
56
  end
@@ -40,12 +40,12 @@ if ESHelper.es_version_satisfies?(">= 2")
40
40
  it "should ignore non-monotonic external version updates" do
41
41
  id = "ev2"
42
42
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "index", "message" => "foo", "my_version" => 99)])
43
- r = es.get(:index => 'logstash-delete', :type => 'doc', :id => id, :refresh => true)
43
+ r = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
44
44
  expect(r['_version']).to eq(99)
45
45
  expect(r['_source']['message']).to eq('foo')
46
46
 
47
47
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "delete", "message" => "foo", "my_version" => 98)])
48
- r2 = es.get(:index => 'logstash-delete', :type => 'doc', :id => id, :refresh => true)
48
+ r2 = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
49
49
  expect(r2['_version']).to eq(99)
50
50
  expect(r2['_source']['message']).to eq('foo')
51
51
  end
@@ -53,12 +53,12 @@ if ESHelper.es_version_satisfies?(">= 2")
53
53
  it "should commit monotonic external version updates" do
54
54
  id = "ev3"
55
55
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "index", "message" => "foo", "my_version" => 99)])
56
- r = es.get(:index => 'logstash-delete', :type => 'doc', :id => id, :refresh => true)
56
+ r = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
57
57
  expect(r['_version']).to eq(99)
58
58
  expect(r['_source']['message']).to eq('foo')
59
59
 
60
60
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "delete", "message" => "foo", "my_version" => 100)])
61
- expect { es.get(:index => 'logstash-delete', :type => 'doc', :id => id, :refresh => true) }.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
61
+ expect { es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true) }.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
62
62
  end
63
63
  end
64
64
  end
@@ -25,7 +25,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
25
25
  @es.indices.delete(:index => "*") rescue nil
26
26
  @es.index(
27
27
  :index => 'logstash-update',
28
- :type => 'doc',
28
+ :type => doc_type,
29
29
  :id => "123",
30
30
  :body => { :message => 'Test', :counter => 1 }
31
31
  )
@@ -37,7 +37,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
37
37
  subject = get_es_output({ 'document_id' => "123", 'script' => 'scripted_update', 'script_type' => 'file' })
38
38
  subject.register
39
39
  subject.multi_receive([LogStash::Event.new("count" => 2)])
40
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
40
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
41
41
  expect(r["_source"]["counter"]).to eq(3)
42
42
  end
43
43
 
@@ -45,7 +45,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
45
45
  subject = get_es_output({ 'document_id' => "123", 'script' => 'scripted_update_nested', 'script_type' => 'file' })
46
46
  subject.register
47
47
  subject.multi_receive([LogStash::Event.new("data" => { "count" => 3 })])
48
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
48
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
49
49
  expect(r["_source"]["counter"]).to eq(4)
50
50
  end
51
51
 
@@ -58,7 +58,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
58
58
  })
59
59
  subject.register
60
60
  subject.multi_receive([LogStash::Event.new("counter" => 3 )])
61
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
61
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
62
62
  expect(r["_source"]["counter"]).to eq(4)
63
63
  end
64
64
 
@@ -72,7 +72,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
72
72
  })
73
73
  subject.register
74
74
  subject.multi_receive([LogStash::Event.new("counter" => 3 )])
75
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
75
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
76
76
  expect(r["_source"]["counter"]).to eq(4)
77
77
  end
78
78
 
@@ -86,7 +86,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
86
86
  })
87
87
  subject.register
88
88
  subject.multi_receive([LogStash::Event.new("counter" => 3 )])
89
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
89
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
90
90
  expect(r["_source"]["counter"]).to eq(3)
91
91
  end
92
92
 
@@ -100,7 +100,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
100
100
  })
101
101
  subject.register
102
102
  subject.multi_receive([LogStash::Event.new("count" => 4 )])
103
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
103
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
104
104
  expect(r["_source"]["counter"]).to eq(5)
105
105
  end
106
106
  end
@@ -110,7 +110,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
110
110
  subject = get_es_output({ 'document_id' => "456", 'upsert' => '{"message": "upsert message"}' })
111
111
  subject.register
112
112
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
113
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
113
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
114
114
  expect(r["_source"]["message"]).to eq('upsert message')
115
115
  end
116
116
 
@@ -118,7 +118,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
118
118
  subject = get_es_output({ 'document_id' => "456", 'doc_as_upsert' => true })
119
119
  subject.register
120
120
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
121
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
121
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
122
122
  expect(r["_source"]["message"]).to eq('sample message here')
123
123
  end
124
124
 
@@ -133,7 +133,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
133
133
  subject = get_es_output({ 'document_id' => "456", 'script' => 'scripted_update', 'upsert' => '{"message": "upsert message"}', 'script_type' => 'file' })
134
134
  subject.register
135
135
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
136
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
136
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
137
137
  expect(r["_source"]["message"]).to eq('upsert message')
138
138
  end
139
139
 
@@ -142,7 +142,7 @@ if ESHelper.es_version_satisfies?('>= 2', '< 6')
142
142
  subject.register
143
143
  subject.multi_receive([LogStash::Event.new("counter" => 1)])
144
144
  @es.indices.refresh
145
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
145
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
146
146
  expect(r["_source"]["counter"]).to eq(1)
147
147
  end
148
148
  end
@@ -79,7 +79,7 @@ describe "indexing" do
79
79
  result = LogStash::Json.load(response.body)
80
80
  result["hits"]["hits"].each do |doc|
81
81
  if ESHelper.es_version_satisfies?(">= 6")
82
- expect(doc["_type"]).to eq("doc")
82
+ expect(doc["_type"]).to eq(doc_type)
83
83
  else
84
84
  expect(doc["_type"]).to eq(type)
85
85
  end
@@ -38,11 +38,11 @@ if ESHelper.es_version_satisfies?(">= 2")
38
38
 
39
39
  it "should default to ES version" do
40
40
  subject.multi_receive([LogStash::Event.new("my_id" => "123", "message" => "foo")])
41
- r = es.get(:index => 'logstash-index', :type => 'doc', :id => "123", :refresh => true)
41
+ r = es.get(:index => 'logstash-index', :type => doc_type, :id => "123", :refresh => true)
42
42
  expect(r["_version"]).to eq(1)
43
43
  expect(r["_source"]["message"]).to eq('foo')
44
44
  subject.multi_receive([LogStash::Event.new("my_id" => "123", "message" => "foobar")])
45
- r2 = es.get(:index => 'logstash-index', :type => 'doc', :id => "123", :refresh => true)
45
+ r2 = es.get(:index => 'logstash-index', :type => doc_type, :id => "123", :refresh => true)
46
46
  expect(r2["_version"]).to eq(2)
47
47
  expect(r2["_source"]["message"]).to eq('foobar')
48
48
  end
@@ -66,7 +66,7 @@ if ESHelper.es_version_satisfies?(">= 2")
66
66
  it "should respect the external version" do
67
67
  id = "ev1"
68
68
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "99", "message" => "foo")])
69
- r = es.get(:index => 'logstash-index', :type => 'doc', :id => id, :refresh => true)
69
+ r = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
70
70
  expect(r["_version"]).to eq(99)
71
71
  expect(r["_source"]["message"]).to eq('foo')
72
72
  end
@@ -74,12 +74,12 @@ if ESHelper.es_version_satisfies?(">= 2")
74
74
  it "should ignore non-monotonic external version updates" do
75
75
  id = "ev2"
76
76
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "99", "message" => "foo")])
77
- r = es.get(:index => 'logstash-index', :type => 'doc', :id => id, :refresh => true)
77
+ r = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
78
78
  expect(r["_version"]).to eq(99)
79
79
  expect(r["_source"]["message"]).to eq('foo')
80
80
 
81
81
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "98", "message" => "foo")])
82
- r2 = es.get(:index => 'logstash-index', :type => 'doc', :id => id, :refresh => true)
82
+ r2 = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
83
83
  expect(r2["_version"]).to eq(99)
84
84
  expect(r2["_source"]["message"]).to eq('foo')
85
85
  end
@@ -87,12 +87,12 @@ if ESHelper.es_version_satisfies?(">= 2")
87
87
  it "should commit monotonic external version updates" do
88
88
  id = "ev3"
89
89
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "99", "message" => "foo")])
90
- r = es.get(:index => 'logstash-index', :type => 'doc', :id => id, :refresh => true)
90
+ r = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
91
91
  expect(r["_version"]).to eq(99)
92
92
  expect(r["_source"]["message"]).to eq('foo')
93
93
 
94
94
  subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "100", "message" => "foo")])
95
- r2 = es.get(:index => 'logstash-index', :type => 'doc', :id => id, :refresh => true)
95
+ r2 = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
96
96
  expect(r2["_version"]).to eq(100)
97
97
  expect(r2["_source"]["message"]).to eq('foo')
98
98
  end
@@ -27,7 +27,7 @@ if ESHelper.es_version_satisfies?(">= 5")
27
27
  @es.indices.delete(:index => "*") rescue nil
28
28
  @es.index(
29
29
  :index => 'logstash-update',
30
- :type => 'doc',
30
+ :type => doc_type,
31
31
  :id => "123",
32
32
  :body => { :message => 'Test', :counter => 1 }
33
33
  )
@@ -41,7 +41,7 @@ if ESHelper.es_version_satisfies?(">= 5")
41
41
  subject = get_es_output({ 'document_id' => "123", 'script' => 'scripted_update', 'script_type' => 'file' })
42
42
  subject.register
43
43
  subject.multi_receive([LogStash::Event.new("count" => 2)])
44
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
44
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
45
45
  expect(r["_source"]["counter"]).to eq(3)
46
46
  end
47
47
 
@@ -49,7 +49,7 @@ if ESHelper.es_version_satisfies?(">= 5")
49
49
  subject = get_es_output({ 'document_id' => "123", 'script' => 'scripted_update_nested', 'script_type' => 'file' })
50
50
  subject.register
51
51
  subject.multi_receive([LogStash::Event.new("data" => { "count" => 3 })])
52
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
52
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
53
53
  expect(r["_source"]["counter"]).to eq(4)
54
54
  end
55
55
  end
@@ -63,7 +63,7 @@ if ESHelper.es_version_satisfies?(">= 5")
63
63
  })
64
64
  subject.register
65
65
  subject.multi_receive([LogStash::Event.new("counter" => 3 )])
66
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
66
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
67
67
  expect(r["_source"]["counter"]).to eq(4)
68
68
  end
69
69
 
@@ -76,7 +76,7 @@ if ESHelper.es_version_satisfies?(">= 5")
76
76
  })
77
77
  subject.register
78
78
  subject.multi_receive([LogStash::Event.new("counter" => 3 )])
79
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
79
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
80
80
  expect(r["_source"]["counter"]).to eq(4)
81
81
  end
82
82
 
@@ -89,7 +89,7 @@ if ESHelper.es_version_satisfies?(">= 5")
89
89
  })
90
90
  subject.register
91
91
  subject.multi_receive([LogStash::Event.new("counter" => 3 )])
92
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
92
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
93
93
  expect(r["_source"]["counter"]).to eq(3)
94
94
  end
95
95
 
@@ -114,7 +114,7 @@ if ESHelper.es_version_satisfies?(">= 5")
114
114
  subject = get_es_output(plugin_parameters)
115
115
  subject.register
116
116
  subject.multi_receive([LogStash::Event.new("count" => 4 )])
117
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
117
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
118
118
  expect(r["_source"]["counter"]).to eq(5)
119
119
  end
120
120
  end
@@ -125,7 +125,7 @@ if ESHelper.es_version_satisfies?(">= 5")
125
125
  subject = get_es_output({ 'document_id' => "456", 'upsert' => '{"message": "upsert message"}' })
126
126
  subject.register
127
127
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
128
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
128
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
129
129
  expect(r["_source"]["message"]).to eq('upsert message')
130
130
  end
131
131
 
@@ -133,7 +133,7 @@ if ESHelper.es_version_satisfies?(">= 5")
133
133
  subject = get_es_output({ 'document_id' => "456", 'doc_as_upsert' => true })
134
134
  subject.register
135
135
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
136
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
136
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
137
137
  expect(r["_source"]["message"]).to eq('sample message here')
138
138
  end
139
139
 
@@ -150,7 +150,7 @@ if ESHelper.es_version_satisfies?(">= 5")
150
150
  subject = get_es_output({ 'document_id' => "456", 'script' => 'scripted_update', 'upsert' => '{"message": "upsert message"}', 'script_type' => 'file' })
151
151
  subject.register
152
152
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
153
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
153
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
154
154
  expect(r["_source"]["message"]).to eq('upsert message')
155
155
  end
156
156
 
@@ -159,7 +159,7 @@ if ESHelper.es_version_satisfies?(">= 5")
159
159
  subject.register
160
160
  subject.multi_receive([LogStash::Event.new("counter" => 1)])
161
161
  @es.indices.refresh
162
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
162
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
163
163
  expect(r["_source"]["counter"]).to eq(1)
164
164
  end
165
165
  end
@@ -169,8 +169,9 @@ if ESHelper.es_version_satisfies?(">= 5")
169
169
  it "should create new documents with upsert content" do
170
170
  subject = get_es_output({ 'document_id' => "456", 'script' => 'ctx._source.counter = params.event.counter', 'upsert' => '{"message": "upsert message"}', 'script_type' => 'inline' })
171
171
  subject.register
172
+
172
173
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
173
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
174
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
174
175
  expect(r["_source"]["message"]).to eq('upsert message')
175
176
  end
176
177
 
@@ -179,7 +180,7 @@ if ESHelper.es_version_satisfies?(">= 5")
179
180
  subject.register
180
181
  subject.multi_receive([LogStash::Event.new("counter" => 1)])
181
182
  @es.indices.refresh
182
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
183
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
183
184
  expect(r["_source"]["counter"]).to eq(1)
184
185
  end
185
186
  end
@@ -4,9 +4,9 @@ require_relative "../../../spec/es_spec_helper"
4
4
  describe "failures in bulk class expected behavior", :integration => true do
5
5
  let(:template) { '{"template" : "not important, will be updated by :index"}' }
6
6
  let(:event1) { LogStash::Event.new("somevalue" => 100, "@timestamp" => "2014-11-17T20:37:17.223Z", "@metadata" => {"retry_count" => 0}) }
7
- let(:action1) { ["index", {:_id=>nil, :_routing=>nil, :_index=>"logstash-2014.11.17", :_type=>"doc"}, event1] }
7
+ let(:action1) { ["index", {:_id=>nil, routing_field_name =>nil, :_index=>"logstash-2014.11.17", :_type=> doc_type }, event1] }
8
8
  let(:event2) { LogStash::Event.new("geoip" => { "location" => [ 0.0, 0.0] }, "@timestamp" => "2014-11-17T20:37:17.223Z", "@metadata" => {"retry_count" => 0}) }
9
- let(:action2) { ["index", {:_id=>nil, :_routing=>nil, :_index=>"logstash-2014.11.17", :_type=>"doc"}, event2] }
9
+ let(:action2) { ["index", {:_id=>nil, routing_field_name =>nil, :_index=>"logstash-2014.11.17", :_type=> doc_type }, event2] }
10
10
  let(:invalid_event) { LogStash::Event.new("geoip" => { "location" => "notlatlon" }, "@timestamp" => "2014-11-17T20:37:17.223Z") }
11
11
 
12
12
  def mock_actions_with_response(*resp)
@@ -82,7 +82,7 @@ if ESHelper.es_version_satisfies?(">= 5")
82
82
  end
83
83
 
84
84
  it "make [geoip][location] a geo_point" do
85
- expect(@es.indices.get_template(name: "logstash")["logstash"]["mappings"]["_default_"]["properties"]["geoip"]["properties"]["location"]["type"]).to eq("geo_point")
85
+ expect(@es.indices.get_template(name: "logstash")["logstash"]["mappings"][mapping_name]["properties"]["geoip"]["properties"]["location"]["type"]).to eq("geo_point")
86
86
  end
87
87
 
88
88
  it "aggregate .keyword results correctly " do
@@ -24,7 +24,7 @@ if ESHelper.es_version_satisfies?(">= 2")
24
24
  @es.indices.delete(:index => "*") rescue nil
25
25
  @es.index(
26
26
  :index => 'logstash-update',
27
- :type => 'doc',
27
+ :type => doc_type,
28
28
  :id => "123",
29
29
  :body => { :message => 'Test', :counter => 1 }
30
30
  )
@@ -41,14 +41,14 @@ if ESHelper.es_version_satisfies?(">= 2")
41
41
  subject = get_es_output({ 'document_id' => "456" } )
42
42
  subject.register
43
43
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
44
- expect {@es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
44
+ expect {@es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
45
45
  end
46
46
 
47
47
  it "should update existing document" do
48
48
  subject = get_es_output({ 'document_id' => "123" })
49
49
  subject.register
50
50
  subject.multi_receive([LogStash::Event.new("message" => "updated message here")])
51
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
51
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
52
52
  expect(r["_source"]["message"]).to eq('updated message here')
53
53
  end
54
54
 
@@ -58,7 +58,7 @@ if ESHelper.es_version_satisfies?(">= 2")
58
58
  subject = get_es_output({ 'document_id' => "123" })
59
59
  subject.register
60
60
  subject.multi_receive([LogStash::Event.new("data" => "updated message here", "message" => "foo")])
61
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
61
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
62
62
  expect(r["_source"]["data"]).to eq('updated message here')
63
63
  expect(r["_source"]["message"]).to eq('foo')
64
64
  end
@@ -95,7 +95,7 @@ if ESHelper.es_version_satisfies?(">= 2")
95
95
  subject = get_es_output({ 'document_id' => "456", 'upsert' => '{"message": "upsert message"}' })
96
96
  subject.register
97
97
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
98
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
98
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
99
99
  expect(r["_source"]["message"]).to eq('upsert message')
100
100
  end
101
101
 
@@ -103,7 +103,7 @@ if ESHelper.es_version_satisfies?(">= 2")
103
103
  subject = get_es_output({ 'document_id' => "456", 'doc_as_upsert' => true })
104
104
  subject.register
105
105
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
106
- r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
106
+ r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
107
107
  expect(r["_source"]["message"]).to eq('sample message here')
108
108
  end
109
109
 
@@ -362,7 +362,7 @@ describe LogStash::Outputs::ElasticSearch do
362
362
  it "should not set the retry_on_conflict parameter when creating an event_action_tuple" do
363
363
  allow(subject.client).to receive(:maximum_seen_major_version).and_return(maximum_seen_major_version)
364
364
  action, params, event_data = subject.event_action_tuple(event)
365
- expect(params).not_to include({:_retry_on_conflict => num_retries})
365
+ expect(params).not_to include({subject.retry_on_conflict_action_name => num_retries})
366
366
  end
367
367
  end
368
368
 
@@ -371,7 +371,7 @@ describe LogStash::Outputs::ElasticSearch do
371
371
 
372
372
  it "should set the retry_on_conflict parameter when creating an event_action_tuple" do
373
373
  action, params, event_data = subject.event_action_tuple(event)
374
- expect(params).to include({:_retry_on_conflict => num_retries})
374
+ expect(params).to include({subject.retry_on_conflict_action_name => num_retries})
375
375
  end
376
376
  end
377
377
 
@@ -380,7 +380,7 @@ describe LogStash::Outputs::ElasticSearch do
380
380
 
381
381
  it "should set the retry_on_conflict parameter when creating an event_action_tuple" do
382
382
  action, params, event_data = subject.event_action_tuple(event)
383
- expect(params).to include({:_retry_on_conflict => num_retries})
383
+ expect(params).to include({subject.retry_on_conflict_action_name => num_retries})
384
384
  expect(action).to eq("update")
385
385
  end
386
386
  end
@@ -4,7 +4,7 @@ require_relative "../../../spec/es_spec_helper"
4
4
  describe "whitelisting error types in expected behavior" do
5
5
  let(:template) { '{"template" : "not important, will be updated by :index"}' }
6
6
  let(:event1) { LogStash::Event.new("somevalue" => 100, "@timestamp" => "2014-11-17T20:37:17.223Z") }
7
- let(:action1) { ["index", {:_id=>1, :_routing=>nil, :_index=>"logstash-2014.11.17", :_type=>"doc"}, event1] }
7
+ let(:action1) { ["index", {:_id=>1, :routing=>nil, :_index=>"logstash-2014.11.17", :_type=> doc_type }, event1] }
8
8
  let(:settings) { {"manage_template" => true, "index" => "logstash-2014.11.17", "template_overwrite" => true, "hosts" => get_host_port() } }
9
9
 
10
10
  subject { LogStash::Outputs::ElasticSearch.new(settings) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.2.3
4
+ version: 9.2.4
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-05 00:00:00.000000000 Z
11
+ date: 2018-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement