logstash-output-elasticsearch 8.2.2-java → 9.0.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 100a0be14e669078212f2b1a5f11513814819bfd
4
- data.tar.gz: 4be944e73c0e885b740f29e211b657dcca3e05f9
3
+ metadata.gz: 5ca4ff178e96df26064af65eb8fb6a4d394c6ff7
4
+ data.tar.gz: 0f5d0ede03e013b1d1c332b889ff1d6166c61f81
5
5
  SHA512:
6
- metadata.gz: 73cd4330d52da5f8a7b30843d554ea95b79c242de425fa8ffae55a5e33b541c6841d70b18d418aeb24f4fbb258e82aa6828d161a16a422345d30b95fe206fdcf
7
- data.tar.gz: d82311c0b9dc47484b50846b5bf05adc0950909b38b5bedfea2b21bf0e464655ff68794efc956864dabb153824f0a1121680fd9de924e63513b43a6fd92dbf7b
6
+ metadata.gz: df4adbd9a19b54b7997ddad28e3e976d62c0124e645bb45855ef4899d07d322e5fce715cde1fb9981cff4c21ad2b7daec4f807f768582e0ef4b44581049ef7f2
7
+ data.tar.gz: 4a0cf366db45cd2b438d568b0dab4b8fda540bf09f6c43c43f0c80bdbf24758d26966812b857ae04cc75e128920a9c18d5c707cc6cb2d3c3e8371e145b14f57b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 9.0.0
2
+ - Change default document type to 'doc' from 'logs' to align with beats and reflect the generic nature of logstash.
3
+ - Deprecate 'document_type' option
4
+
1
5
  ### 8.2.2
2
6
  - Use `#response_body` instead of `#body` when debugging response from the server #679
3
7
 
data/docs/index.asciidoc CHANGED
@@ -236,11 +236,14 @@ Elasticsearch with the same ID.
236
236
 
237
237
  * Value type is <<string,string>>
238
238
  * There is no default value for this setting.
239
+ * This option is deprecated
239
240
 
240
- The document type to write events to. Generally you should try to write only
241
+ Note: This option is deprecated due to the https://www.elastic.co/guide/en/elasticsearch/reference/6.0/removal-of-types.html[removal of types in Logstash 6.0].
242
+ It will be removed in the next major version of Logstash.
243
+ This sets the document type to write events to. Generally you should try to write only
241
244
  similar events to the same 'type'. String expansion `%{foo}` works here.
242
245
  Unless you set 'document_type', the event 'type' will be used if it exists
243
- otherwise the document type will be assigned the value of 'logs'
246
+ otherwise the document type will be assigned the value of 'doc'.
244
247
 
245
248
  [id="plugins-{type}s-{plugin}-failure_type_logging_whitelist"]
246
249
  ===== `failure_type_logging_whitelist`
@@ -477,7 +480,8 @@ Set script name for scripted update mode
477
480
  * Value type is <<string,string>>
478
481
  * Default value is `"painless"`
479
482
 
480
- Set the language of the used script. If not set, this defaults to painless in ES 5.0
483
+ Set the language of the used script. If not set, this defaults to painless in ES 5.0.
484
+ When using indexed (stored) scripts on Elasticsearch 6 and higher, you must set this parameter to `""` (empty string).
481
485
 
482
486
  [id="plugins-{type}s-{plugin}-script_type"]
483
487
  ===== `script_type`
@@ -204,7 +204,7 @@ module LogStash; module Outputs; class ElasticSearch;
204
204
  type = if @document_type
205
205
  event.sprintf(@document_type)
206
206
  else
207
- event.get("type") || "logs"
207
+ event.get("type") || "doc"
208
208
  end
209
209
 
210
210
  if !(type.is_a?(String) || type.is_a?(Numeric))
@@ -12,11 +12,9 @@ module LogStash; module Outputs; class ElasticSearch
12
12
  # Joda formats are defined http://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html[here].
13
13
  mod.config :index, :validate => :string, :default => "logstash-%{+YYYY.MM.dd}"
14
14
 
15
- # The document type to write events to. Generally you should try to write only
16
- # similar events to the same 'type'. String expansion `%{foo}` works here.
17
- # Unless you set 'document_type', the event 'type' will be used if it exists
18
- # otherwise the document type will be assigned the value of 'logs'
19
- mod.config :document_type, :validate => :string
15
+ mod.config :document_type,
16
+ :validate => :string,
17
+ :deprecated => "Document types are being deprecated in Elasticsearch 6.0, and removed entirely in 7.0. You should avoid this feature"
20
18
 
21
19
  # From Logstash 1.3 onwards, a template is applied to Elasticsearch during
22
20
  # Logstash's startup if one with the name `template_name` does not already exist.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch'
3
- s.version = '8.2.2'
3
+ s.version = '9.0.0'
4
4
  s.licenses = ['apache-2.0']
5
5
  s.summary = "Logstash Output to 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"
@@ -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 => 'logs', :id => id, :refresh => true)
43
+ r = es.get(:index => 'logstash-delete', :type => 'doc', :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 => 'logs', :id => id, :refresh => true)
48
+ r2 = es.get(:index => 'logstash-delete', :type => 'doc', :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 => 'logs', :id => id, :refresh => true)
56
+ r = es.get(:index => 'logstash-delete', :type => 'doc', :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 => 'logs', :id => id, :refresh => true) }.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
61
+ expect { es.get(:index => 'logstash-delete', :type => 'doc', :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 => 'logs',
28
+ :type => 'doc',
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 => 'logs', :id => "123", :refresh => true)
40
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
41
41
  insist { r["_source"]["counter"] } == 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 => 'logs', :id => "123", :refresh => true)
48
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
49
49
  insist { r["_source"]["counter"] } == 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 => 'logs', :id => "123", :refresh => true)
61
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
62
62
  insist { r["_source"]["counter"] } == 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 => 'logs', :id => "123", :refresh => true)
75
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
76
76
  insist { r["_source"]["counter"] } == 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 => 'logs', :id => "456", :refresh => true)
89
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
90
90
  insist { r["_source"]["counter"] } == 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 => 'logs', :id => "123", :refresh => true)
103
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
104
104
  insist { r["_source"]["counter"] } == 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 => 'logs', :id => "456", :refresh => true)
113
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
114
114
  insist { r["_source"]["message"] } == '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 => 'logs', :id => "456", :refresh => true)
121
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
122
122
  insist { r["_source"]["message"] } == '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 => 'logs', :id => "456", :refresh => true)
136
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
137
137
  insist { r["_source"]["message"] } == '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 => 'logs', :id => "456", :refresh => true)
145
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
146
146
  insist { r["_source"]["counter"] } == 1
147
147
  end
148
148
  end
@@ -113,8 +113,8 @@ describe "indexing" do
113
113
  it_behaves_like("an indexer")
114
114
  end
115
115
 
116
- describe "an indexer with no type value set (default to logs)", :integration => true do
117
- let(:type) { "logs" }
116
+ describe "an indexer with no type value set (default to doc)", :integration => true do
117
+ let(:type) { "doc" }
118
118
  let(:config) {
119
119
  {
120
120
  "hosts" => get_host_port,
@@ -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 => 'logs', :id => "123", :refresh => true)
41
+ r = es.get(:index => 'logstash-index', :type => 'doc', :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 => 'logs', :id => "123", :refresh => true)
45
+ r2 = es.get(:index => 'logstash-index', :type => 'doc', :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 => 'logs', :id => id, :refresh => true)
69
+ r = es.get(:index => 'logstash-index', :type => 'doc', :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 => 'logs', :id => id, :refresh => true)
77
+ r = es.get(:index => 'logstash-index', :type => 'doc', :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 => 'logs', :id => id, :refresh => true)
82
+ r2 = es.get(:index => 'logstash-index', :type => 'doc', :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 => 'logs', :id => id, :refresh => true)
90
+ r = es.get(:index => 'logstash-index', :type => 'doc', :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 => 'logs', :id => id, :refresh => true)
95
+ r2 = es.get(:index => 'logstash-index', :type => 'doc', :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 => 'logs',
30
+ :type => 'doc',
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 => 'logs', :id => "123", :refresh => true)
44
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
45
45
  insist { r["_source"]["counter"] } == 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 => 'logs', :id => "123", :refresh => true)
52
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
53
53
  insist { r["_source"]["counter"] } == 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 => 'logs', :id => "123", :refresh => true)
66
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
67
67
  insist { r["_source"]["counter"] } == 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 => 'logs', :id => "123", :refresh => true)
79
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
80
80
  insist { r["_source"]["counter"] } == 4
81
81
  end
82
82
 
@@ -89,24 +89,33 @@ 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 => 'logs', :id => "456", :refresh => true)
92
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
93
93
  insist { r["_source"]["counter"] } == 3
94
94
  end
95
95
 
96
- if ESHelper.es_version_satisfies?('<6')
97
- context 'with an indexed script' do
98
- it "should increment a counter with event/doc 'count' variable with indexed script" do
99
- @es.put_script lang: 'painless', id: 'indexed_update', body: { script: 'ctx._source.counter += params.event.count' }
100
- subject = get_es_output({
101
- 'document_id' => "123",
102
- 'script' => 'indexed_update',
103
- 'script_type' => 'indexed'
104
- })
105
- subject.register
106
- subject.multi_receive([LogStash::Event.new("count" => 4 )])
107
- r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "123", :refresh => true)
108
- insist { r["_source"]["counter"] } == 5
96
+ context 'with an indexed script' do
97
+ it "should increment a counter with event/doc 'count' variable with indexed script" do
98
+ if ESHelper.es_version_satisfies?('<6')
99
+ @es.perform_request(:put, "_scripts/painless/indexed_update", {}, {"script" => "ctx._source.counter += params.event.count" })
100
+ else
101
+ @es.perform_request(:put, "_scripts/indexed_update", {}, {"script" => {"source" => "ctx._source.counter += params.event.count", "lang" => "painless"}})
109
102
  end
103
+
104
+ plugin_parameters = {
105
+ 'document_id' => "123",
106
+ 'script' => 'indexed_update',
107
+ 'script_type' => 'indexed'
108
+ }
109
+
110
+ if ESHelper.es_version_satisfies?('>= 6.0.0')
111
+ plugin_parameters.merge!('script_lang' => '')
112
+ end
113
+
114
+ subject = get_es_output(plugin_parameters)
115
+ subject.register
116
+ subject.multi_receive([LogStash::Event.new("count" => 4 )])
117
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
118
+ insist { r["_source"]["counter"] } == 5
110
119
  end
111
120
  end
112
121
  end
@@ -116,7 +125,7 @@ if ESHelper.es_version_satisfies?(">= 5")
116
125
  subject = get_es_output({ 'document_id' => "456", 'upsert' => '{"message": "upsert message"}' })
117
126
  subject.register
118
127
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
119
- r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "456", :refresh => true)
128
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
120
129
  insist { r["_source"]["message"] } == 'upsert message'
121
130
  end
122
131
 
@@ -124,7 +133,7 @@ if ESHelper.es_version_satisfies?(">= 5")
124
133
  subject = get_es_output({ 'document_id' => "456", 'doc_as_upsert' => true })
125
134
  subject.register
126
135
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
127
- r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "456", :refresh => true)
136
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
128
137
  insist { r["_source"]["message"] } == 'sample message here'
129
138
  end
130
139
 
@@ -141,7 +150,7 @@ if ESHelper.es_version_satisfies?(">= 5")
141
150
  subject = get_es_output({ 'document_id' => "456", 'script' => 'scripted_update', 'upsert' => '{"message": "upsert message"}', 'script_type' => 'file' })
142
151
  subject.register
143
152
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
144
- r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "456", :refresh => true)
153
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
145
154
  insist { r["_source"]["message"] } == 'upsert message'
146
155
  end
147
156
 
@@ -150,7 +159,7 @@ if ESHelper.es_version_satisfies?(">= 5")
150
159
  subject.register
151
160
  subject.multi_receive([LogStash::Event.new("counter" => 1)])
152
161
  @es.indices.refresh
153
- r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "456", :refresh => true)
162
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
154
163
  insist { r["_source"]["counter"] } == 1
155
164
  end
156
165
  end
@@ -161,7 +170,7 @@ if ESHelper.es_version_satisfies?(">= 5")
161
170
  subject = get_es_output({ 'document_id' => "456", 'script' => 'ctx._source.counter = params.event.counter', 'upsert' => '{"message": "upsert message"}', 'script_type' => 'inline' })
162
171
  subject.register
163
172
  subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
164
- r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "456", :refresh => true)
173
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
165
174
  insist { r["_source"]["message"] } == 'upsert message'
166
175
  end
167
176
 
@@ -170,7 +179,7 @@ if ESHelper.es_version_satisfies?(">= 5")
170
179
  subject.register
171
180
  subject.multi_receive([LogStash::Event.new("counter" => 1)])
172
181
  @es.indices.refresh
173
- r = @es.get(:index => 'logstash-update', :type => 'logs', :id => "456", :refresh => true)
182
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
174
183
  insist { r["_source"]["counter"] } == 1
175
184
  end
176
185
  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=>"logs"}, event1] }
7
+ let(:action1) { ["index", {:_id=>nil, :_routing=>nil, :_index=>"logstash-2014.11.17", :_type=>"doc"}, 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=>"logs"}, event2] }
9
+ let(:action2) { ["index", {:_id=>nil, :_routing=>nil, :_index=>"logstash-2014.11.17", :_type=>"doc"}, 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)
@@ -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 => 'logs',
27
+ :type => 'doc',
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 => 'logs', :id => "456", :refresh => true)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
44
+ expect {@es.get(:index => 'logstash-update', :type => 'doc', :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 => 'logs', :id => "123", :refresh => true)
51
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
52
52
  insist { r["_source"]["message"] } == '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 => 'logs', :id => "123", :refresh => true)
61
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "123", :refresh => true)
62
62
  insist { r["_source"]["data"] } == 'updated message here'
63
63
  insist { r["_source"]["message"] } == '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 => 'logs', :id => "456", :refresh => true)
98
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
99
99
  insist { r["_source"]["message"] } == '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 => 'logs', :id => "456", :refresh => true)
106
+ r = @es.get(:index => 'logstash-update', :type => 'doc', :id => "456", :refresh => true)
107
107
  insist { r["_source"]["message"] } == 'sample message here'
108
108
  end
109
109
 
@@ -37,8 +37,8 @@ describe "outputs/elasticsearch" do
37
37
  end
38
38
 
39
39
  describe "getting a document type" do
40
- it "should default to 'logs'" do
41
- expect(eso.send(:get_event_type, LogStash::Event.new)).to eql("logs")
40
+ it "should default to 'doc'" do
41
+ expect(eso.send(:get_event_type, LogStash::Event.new)).to eql("doc")
42
42
  end
43
43
 
44
44
  it "should get the type from the event if nothing else specified in the config" do
@@ -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=>"logs"}, event1] }
7
+ let(:action1) { ["index", {:_id=>1, :_routing=>nil, :_index=>"logstash-2014.11.17", :_type=>"doc"}, 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: 8.2.2
4
+ version: 9.0.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-21 00:00:00.000000000 Z
11
+ date: 2017-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement