logstash-output-elasticsearch 11.0.2-java → 11.0.3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/logstash/outputs/elasticsearch.rb +3 -14
- data/lib/logstash/outputs/elasticsearch/http_client/pool.rb +2 -28
- data/lib/logstash/outputs/elasticsearch/ilm.rb +2 -33
- data/lib/logstash/outputs/elasticsearch/template_manager.rb +1 -1
- data/lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-8x.json +1 -0
- data/logstash-output-elasticsearch.gemspec +2 -2
- data/spec/es_spec_helper.rb +4 -6
- data/spec/fixtures/_nodes/{5x_6x.json → 6x.json} +5 -5
- data/spec/integration/outputs/compressed_indexing_spec.rb +47 -46
- data/spec/integration/outputs/delete_spec.rb +49 -51
- data/spec/integration/outputs/ilm_spec.rb +230 -246
- data/spec/integration/outputs/index_spec.rb +5 -2
- data/spec/integration/outputs/index_version_spec.rb +78 -82
- data/spec/integration/outputs/ingest_pipeline_spec.rb +58 -60
- data/spec/integration/outputs/painless_update_spec.rb +74 -164
- data/spec/integration/outputs/parent_spec.rb +67 -75
- data/spec/integration/outputs/retry_spec.rb +2 -2
- data/spec/integration/outputs/sniffer_spec.rb +15 -53
- data/spec/integration/outputs/templates_spec.rb +79 -81
- data/spec/integration/outputs/update_spec.rb +99 -101
- data/spec/spec_helper.rb +1 -5
- data/spec/unit/outputs/elasticsearch/data_stream_support_spec.rb +0 -14
- data/spec/unit/outputs/elasticsearch/http_client/pool_spec.rb +30 -37
- data/spec/unit/outputs/elasticsearch/template_manager_spec.rb +9 -9
- data/spec/unit/outputs/elasticsearch_spec.rb +1 -8
- metadata +8 -22
- data/lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-2x.json +0 -95
- data/lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-5x.json +0 -46
- data/spec/fixtures/_nodes/2x_1x.json +0 -27
- data/spec/fixtures/scripts/groovy/scripted_update.groovy +0 -2
- data/spec/fixtures/scripts/groovy/scripted_update_nested.groovy +0 -2
- data/spec/fixtures/scripts/groovy/scripted_upsert.groovy +0 -2
- data/spec/integration/outputs/groovy_update_spec.rb +0 -150
- data/spec/integration/outputs/templates_5x_spec.rb +0 -98
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 143b78ff484990a35c4d9a1b54ccb040bdba7e6aa2fd69928b0553544883fabd
|
4
|
+
data.tar.gz: a14e65b2b499d65d9a8f3389d0c0168f0447e1358338d867dd5b05a78ca28c13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd6495287f9d5dff77d6006c5495013335eb869b7a9678973567358b9ce6ed772822cda5b38bfbeff1831e72406a4e550125cfafd9cbaeab20b588ccf584a7b6
|
7
|
+
data.tar.gz: d6eda43b3338ad401b889ff20f7bd246b3a44f921b0f006989572cb95145a518cb7103a1c23fd930018c2552316af33d356d4fecc8210ca95f0a6259a2b1037f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 11.0.3
|
2
|
+
- Fixed SSL handshake hang indefinitely with proxy setup [#1032](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1032)
|
3
|
+
|
1
4
|
## 11.0.2
|
2
5
|
- Validate that required functionality in Elasticsearch is available upon initial connection [#1015](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1015)
|
3
6
|
|
@@ -443,7 +443,7 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
443
443
|
end
|
444
444
|
|
445
445
|
def routing_field_name
|
446
|
-
|
446
|
+
:routing
|
447
447
|
end
|
448
448
|
|
449
449
|
# Determine the correct value for the 'type' field for the given event
|
@@ -456,9 +456,7 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
456
456
|
event.sprintf(@document_type)
|
457
457
|
else
|
458
458
|
major_version = maximum_seen_major_version
|
459
|
-
if major_version
|
460
|
-
es5_event_type(event)
|
461
|
-
elsif major_version == 6
|
459
|
+
if major_version == 6
|
462
460
|
DEFAULT_EVENT_TYPE_ES6
|
463
461
|
elsif major_version == 7
|
464
462
|
DEFAULT_EVENT_TYPE_ES7
|
@@ -470,15 +468,6 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
470
468
|
type.to_s
|
471
469
|
end
|
472
470
|
|
473
|
-
def es5_event_type(event)
|
474
|
-
type = event.get('type')
|
475
|
-
return DEFAULT_EVENT_TYPE_ES6 unless type
|
476
|
-
if !type.is_a?(String) && !type.is_a?(Numeric)
|
477
|
-
@logger.warn("Bad event type (non-string/integer type value set)", :type_class => type.class, :type_value => type, :event => event.to_hash)
|
478
|
-
end
|
479
|
-
type
|
480
|
-
end
|
481
|
-
|
482
471
|
##
|
483
472
|
# WARNING: This method is overridden in a subclass in Logstash Core 7.7-7.8's monitoring,
|
484
473
|
# where a `client` argument is both required and ignored. In later versions of
|
@@ -487,7 +476,7 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
|
|
487
476
|
# @param noop_required_client [nil]: required `nil` for legacy reasons.
|
488
477
|
# @return [Boolean]
|
489
478
|
def use_event_type?(noop_required_client)
|
490
|
-
# always set type for ES
|
479
|
+
# always set type for ES 6
|
491
480
|
# for ES 7 only set it if the user defined it
|
492
481
|
(maximum_seen_major_version < 7) || (maximum_seen_major_version == 7 && @document_type)
|
493
482
|
end
|
@@ -176,15 +176,7 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
|
|
176
176
|
@logger.warn("Sniff returned no nodes! Will not update hosts.")
|
177
177
|
return nil
|
178
178
|
else
|
179
|
-
|
180
|
-
when 5, 6, 7, 8
|
181
|
-
sniff_5x_and_above(nodes)
|
182
|
-
when 2, 1
|
183
|
-
sniff_2x_1x(nodes)
|
184
|
-
else
|
185
|
-
@logger.warn("Could not determine version for nodes in ES cluster!")
|
186
|
-
return nil
|
187
|
-
end
|
179
|
+
sniff(nodes)
|
188
180
|
end
|
189
181
|
end
|
190
182
|
|
@@ -192,7 +184,7 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
|
|
192
184
|
version_string.split('.').first.to_i
|
193
185
|
end
|
194
186
|
|
195
|
-
def
|
187
|
+
def sniff(nodes)
|
196
188
|
nodes.map do |id,info|
|
197
189
|
# Skip master-only nodes
|
198
190
|
next if info["roles"] && info["roles"] == ["master"]
|
@@ -208,24 +200,6 @@ module LogStash; module Outputs; class ElasticSearch; class HttpClient;
|
|
208
200
|
end
|
209
201
|
end
|
210
202
|
|
211
|
-
def sniff_2x_1x(nodes)
|
212
|
-
nodes.map do |id,info|
|
213
|
-
# TODO Make sure this works with shield. Does that listed
|
214
|
-
# stuff as 'https_address?'
|
215
|
-
|
216
|
-
addr_str = info['http_address'].to_s
|
217
|
-
next unless addr_str # Skip hosts with HTTP disabled
|
218
|
-
|
219
|
-
# Only connect to nodes that serve data
|
220
|
-
# this will skip connecting to client, tribe, and master only nodes
|
221
|
-
# Note that if 'attributes' is NOT set, then that's just a regular node
|
222
|
-
# with master + data + client enabled, so we allow that
|
223
|
-
attributes = info['attributes']
|
224
|
-
next if attributes && attributes['data'] == 'false'
|
225
|
-
address_str_to_uri(addr_str)
|
226
|
-
end.compact
|
227
|
-
end
|
228
|
-
|
229
203
|
def stop_sniffer
|
230
204
|
@sniffer.join if @sniffer
|
231
205
|
end
|
@@ -16,20 +16,12 @@ module LogStash; module Outputs; class ElasticSearch
|
|
16
16
|
begin
|
17
17
|
if @ilm_enabled == 'auto'
|
18
18
|
if ilm_on_by_default?
|
19
|
-
|
20
|
-
if !ilm_ready
|
21
|
-
@logger.info("Index Lifecycle Management is set to 'auto', but will be disabled - #{error}")
|
22
|
-
false
|
23
|
-
else
|
24
|
-
ilm_alias_set?
|
25
|
-
end
|
19
|
+
ilm_alias_set?
|
26
20
|
else
|
27
21
|
@logger.info("Index Lifecycle Management is set to 'auto', but will be disabled - Your Elasticsearch cluster is before 7.0.0, which is the minimum version required to automatically run Index Lifecycle Management")
|
28
22
|
false
|
29
23
|
end
|
30
24
|
elsif @ilm_enabled.to_s == 'true'
|
31
|
-
ilm_ready, error = ilm_ready?
|
32
|
-
raise LogStash::ConfigurationError,"Index Lifecycle Management is set to enabled in Logstash, but cannot be used - #{error}" unless ilm_ready
|
33
25
|
ilm_alias_set?
|
34
26
|
else
|
35
27
|
false
|
@@ -47,29 +39,6 @@ module LogStash; module Outputs; class ElasticSearch
|
|
47
39
|
maximum_seen_major_version >= 7
|
48
40
|
end
|
49
41
|
|
50
|
-
def ilm_ready?
|
51
|
-
# Check the Elasticsearch instance for ILM readiness - this means that the version has to be a non-OSS release, with ILM feature
|
52
|
-
# available and enabled.
|
53
|
-
begin
|
54
|
-
xpack = client.get_xpack_info
|
55
|
-
features = xpack.nil? || xpack.empty? ? nil : xpack["features"]
|
56
|
-
ilm = features.nil? ? nil : features["ilm"]
|
57
|
-
return false, "Index Lifecycle management is not installed on your Elasticsearch cluster" if features.nil? || ilm.nil?
|
58
|
-
return false, "Index Lifecycle management is not available in your Elasticsearch cluster" unless ilm['available']
|
59
|
-
return false, "Index Lifecycle management is not enabled in your Elasticsearch cluster" unless ilm['enabled']
|
60
|
-
return true, nil
|
61
|
-
rescue ::LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError => e
|
62
|
-
# Check xpack endpoint: If no xpack endpoint, then this version of Elasticsearch is not compatible
|
63
|
-
if e.response_code == 404
|
64
|
-
return false, "Index Lifecycle management is not installed on your Elasticsearch cluster"
|
65
|
-
elsif e.response_code == 400
|
66
|
-
return false, "Index Lifecycle management is not installed on your Elasticsearch cluster"
|
67
|
-
else
|
68
|
-
raise e
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
42
|
def default_index?(index)
|
74
43
|
index == @default_index
|
75
44
|
end
|
@@ -113,4 +82,4 @@ module LogStash; module Outputs; class ElasticSearch
|
|
113
82
|
LogStash::Json.load(::IO.read(policy_path))
|
114
83
|
end
|
115
84
|
end
|
116
|
-
end; end; end
|
85
|
+
end; end; end
|
@@ -53,7 +53,7 @@ module LogStash; module Outputs; class ElasticSearch
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def self.default_template_path(es_major_version, ecs_compatibility=:disabled)
|
56
|
-
template_version = es_major_version
|
56
|
+
template_version = es_major_version
|
57
57
|
default_template_name = "templates/ecs-#{ecs_compatibility}/elasticsearch-#{template_version}x.json"
|
58
58
|
::File.expand_path(default_template_name, ::File.dirname(__FILE__))
|
59
59
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
lib/logstash/outputs/elasticsearch/templates/ecs-v1/Users/yaauie/src/elastic/logstash-plugins/logsta
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-elasticsearch'
|
3
|
-
s.version = '11.0.
|
3
|
+
s.version = '11.0.3'
|
4
4
|
|
5
5
|
s.licenses = ['apache-2.0']
|
6
6
|
s.summary = "Stores logs in Elasticsearch"
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
# Special flag to let us know this is actually a logstash plugin
|
22
22
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
|
23
23
|
|
24
|
-
s.add_runtime_dependency "manticore", '>= 0.
|
24
|
+
s.add_runtime_dependency "manticore", '>= 0.7.1', '< 1.0.0'
|
25
25
|
s.add_runtime_dependency 'stud', ['>= 0.0.17', '~> 0.0']
|
26
26
|
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
27
27
|
s.add_runtime_dependency 'logstash-mixin-ecs_compatibility_support', '~>1.0'
|
data/spec/es_spec_helper.rb
CHANGED
@@ -20,7 +20,9 @@ module ESHelper
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def get_client
|
23
|
-
Elasticsearch::Client.new(:hosts => [get_host_port])
|
23
|
+
Elasticsearch::Client.new(:hosts => [get_host_port]).tap do |client|
|
24
|
+
allow(client).to receive(:verify_elasticsearch).and_return(true) # bypass client side version checking
|
25
|
+
end
|
24
26
|
end
|
25
27
|
|
26
28
|
def doc_type
|
@@ -53,11 +55,7 @@ module ESHelper
|
|
53
55
|
end
|
54
56
|
|
55
57
|
def routing_field_name
|
56
|
-
|
57
|
-
:routing
|
58
|
-
else
|
59
|
-
:_routing
|
60
|
-
end
|
58
|
+
:routing
|
61
59
|
end
|
62
60
|
|
63
61
|
def self.es_version
|
@@ -11,7 +11,7 @@
|
|
11
11
|
"transport_address" : "http://localhost:9200",
|
12
12
|
"host" : "localhost",
|
13
13
|
"ip" : "127.0.0.1",
|
14
|
-
"version" : "
|
14
|
+
"version" : "6.8.10",
|
15
15
|
"build_hash" : "19c13d0",
|
16
16
|
"roles" : [
|
17
17
|
"master"
|
@@ -29,7 +29,7 @@
|
|
29
29
|
"transport_address" : "http://localhost:9201",
|
30
30
|
"host" : "localhost",
|
31
31
|
"ip" : "127.0.0.1",
|
32
|
-
"version" : "
|
32
|
+
"version" : "6.8.10",
|
33
33
|
"build_hash" : "19c13d0",
|
34
34
|
"roles" : [
|
35
35
|
"data"
|
@@ -47,7 +47,7 @@
|
|
47
47
|
"transport_address" : "http://localhost:9202",
|
48
48
|
"host" : "localhost",
|
49
49
|
"ip" : "127.0.0.1",
|
50
|
-
"version" : "
|
50
|
+
"version" : "6.8.10",
|
51
51
|
"build_hash" : "19c13d0",
|
52
52
|
"roles" : [
|
53
53
|
"data",
|
@@ -66,7 +66,7 @@
|
|
66
66
|
"transport_address" : "http://localhost:9203",
|
67
67
|
"host" : "localhost",
|
68
68
|
"ip" : "127.0.0.1",
|
69
|
-
"version" : "
|
69
|
+
"version" : "6.8.10",
|
70
70
|
"build_hash" : "19c13d0",
|
71
71
|
"roles" : [ ],
|
72
72
|
"http" : {
|
@@ -78,4 +78,4 @@
|
|
78
78
|
}
|
79
79
|
}
|
80
80
|
}
|
81
|
-
}
|
81
|
+
}
|
@@ -8,62 +8,63 @@ RSpec::Matchers.define :a_valid_gzip_encoded_string do
|
|
8
8
|
}
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
"http_compression" => true
|
23
|
-
}
|
11
|
+
describe "indexing with http_compression turned on", :integration => true do
|
12
|
+
let(:event) { LogStash::Event.new("message" => "Hello World!", "type" => type) }
|
13
|
+
let(:index) { 10.times.collect { rand(10).to_s }.join("") }
|
14
|
+
let(:type) { ESHelper.es_version_satisfies?("< 7") ? "doc" : "_doc" }
|
15
|
+
let(:event_count) { 10000 + rand(500) }
|
16
|
+
let(:events) { event_count.times.map { event }.to_a }
|
17
|
+
let(:config) {
|
18
|
+
{
|
19
|
+
"hosts" => get_host_port,
|
20
|
+
"index" => index,
|
21
|
+
"http_compression" => true
|
24
22
|
}
|
25
|
-
|
23
|
+
}
|
24
|
+
subject { LogStash::Outputs::ElasticSearch.new(config) }
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
let(:es_url) { "http://#{get_host_port}" }
|
27
|
+
let(:index_url) {"#{es_url}/#{index}"}
|
28
|
+
let(:http_client_options) { {} }
|
29
|
+
let(:http_client) do
|
30
|
+
Manticore::Client.new(http_client_options)
|
31
|
+
end
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
before do
|
34
|
+
subject.register
|
35
|
+
subject.multi_receive([])
|
36
|
+
end
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
shared_examples "an indexer" do
|
39
|
+
it "ships events" do
|
40
|
+
subject.multi_receive(events)
|
42
41
|
|
43
|
-
|
42
|
+
http_client.post("#{es_url}/_refresh").call
|
44
43
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
response = http_client.get("#{index_url}/_count?q=*")
|
45
|
+
result = LogStash::Json.load(response.body)
|
46
|
+
cur_count = result["count"]
|
47
|
+
expect(cur_count).to eq(event_count)
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
expect(doc
|
55
|
-
|
49
|
+
response = http_client.get("#{index_url}/_search?q=*&size=1000")
|
50
|
+
result = LogStash::Json.load(response.body)
|
51
|
+
result["hits"]["hits"].each do |doc|
|
52
|
+
if ESHelper.es_version_satisfies?("< 8")
|
53
|
+
expect(doc["_type"]).to eq(type)
|
54
|
+
else
|
55
|
+
expect(doc).not_to include("_type")
|
56
56
|
end
|
57
|
+
expect(doc["_index"]).to eq(index)
|
57
58
|
end
|
58
59
|
end
|
60
|
+
end
|
59
61
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
it_behaves_like("an indexer")
|
62
|
+
it "sets the correct content-encoding header and body is compressed" do
|
63
|
+
expect(subject.client.pool.adapter.client).to receive(:send).
|
64
|
+
with(anything, anything, {:headers=>{"Content-Encoding"=>"gzip", "Content-Type"=>"application/json"}, :body => a_valid_gzip_encoded_string}).
|
65
|
+
and_call_original
|
66
|
+
subject.multi_receive(events)
|
68
67
|
end
|
68
|
+
|
69
|
+
it_behaves_like("an indexer")
|
69
70
|
end
|
@@ -2,64 +2,62 @@ require_relative "../../../spec/es_spec_helper"
|
|
2
2
|
require "logstash/outputs/elasticsearch"
|
3
3
|
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
describe "Versioned delete", :integration => true do
|
6
|
+
require "logstash/outputs/elasticsearch"
|
7
|
+
|
8
|
+
let(:es) { get_client }
|
9
|
+
|
10
|
+
before :each do
|
11
|
+
# Delete all templates first.
|
12
|
+
# Clean ES of data before we start.
|
13
|
+
es.indices.delete_template(:name => "*")
|
14
|
+
# This can fail if there are no indexes, ignore failure.
|
15
|
+
es.indices.delete(:index => "*") rescue nil
|
16
|
+
es.indices.refresh
|
17
|
+
end
|
8
18
|
|
9
|
-
|
19
|
+
context "when delete only" do
|
20
|
+
subject { LogStash::Outputs::ElasticSearch.new(settings) }
|
10
21
|
|
11
|
-
before
|
12
|
-
|
13
|
-
# Clean ES of data before we start.
|
14
|
-
es.indices.delete_template(:name => "*")
|
15
|
-
# This can fail if there are no indexes, ignore failure.
|
16
|
-
es.indices.delete(:index => "*") rescue nil
|
17
|
-
es.indices.refresh
|
22
|
+
before do
|
23
|
+
subject.register
|
18
24
|
end
|
19
25
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
"hosts" => get_host_port(),
|
33
|
-
"document_id" => "%{my_id}",
|
34
|
-
"version" => "%{my_version}",
|
35
|
-
"version_type" => "external",
|
36
|
-
"action" => "%{my_action}"
|
37
|
-
}
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should ignore non-monotonic external version updates" do
|
41
|
-
id = "ev2"
|
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_type, :id => id, :refresh => true)
|
44
|
-
expect(r['_version']).to eq(99)
|
45
|
-
expect(r['_source']['message']).to eq('foo')
|
26
|
+
let(:settings) do
|
27
|
+
{
|
28
|
+
"manage_template" => true,
|
29
|
+
"index" => "logstash-delete",
|
30
|
+
"template_overwrite" => true,
|
31
|
+
"hosts" => get_host_port(),
|
32
|
+
"document_id" => "%{my_id}",
|
33
|
+
"version" => "%{my_version}",
|
34
|
+
"version_type" => "external",
|
35
|
+
"action" => "%{my_action}"
|
36
|
+
}
|
37
|
+
end
|
46
38
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
39
|
+
it "should ignore non-monotonic external version updates" do
|
40
|
+
id = "ev2"
|
41
|
+
subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "index", "message" => "foo", "my_version" => 99)])
|
42
|
+
r = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
|
43
|
+
expect(r['_version']).to eq(99)
|
44
|
+
expect(r['_source']['message']).to eq('foo')
|
45
|
+
|
46
|
+
subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "delete", "message" => "foo", "my_version" => 98)])
|
47
|
+
r2 = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
|
48
|
+
expect(r2['_version']).to eq(99)
|
49
|
+
expect(r2['_source']['message']).to eq('foo')
|
50
|
+
end
|
52
51
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
52
|
+
it "should commit monotonic external version updates" do
|
53
|
+
id = "ev3"
|
54
|
+
subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "index", "message" => "foo", "my_version" => 99)])
|
55
|
+
r = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
|
56
|
+
expect(r['_version']).to eq(99)
|
57
|
+
expect(r['_source']['message']).to eq('foo')
|
59
58
|
|
60
|
-
|
61
|
-
|
62
|
-
end
|
59
|
+
subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "delete", "message" => "foo", "my_version" => 100)])
|
60
|
+
expect { es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true) }.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
|
63
61
|
end
|
64
62
|
end
|
65
63
|
end
|