logstash-output-elasticsearch 10.8.2-java → 10.8.3-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
  SHA256:
3
- metadata.gz: d6c80e3faba2acade7f891f8e55f4371859337b80457051529264bed69ef0151
4
- data.tar.gz: 00d8cfa6da32835ba9151f5f379c416bd0d4b5ea4d26d05e179da922ede8d8ed
3
+ metadata.gz: 4e7c81c4ce31203196fe4f6c377ea7785cc737b72aaa12abcd9afa7c625a7f72
4
+ data.tar.gz: 77257a5df5d92a5d06a75428e525fc9857123ed72e295b405dce451be27954b7
5
5
  SHA512:
6
- metadata.gz: 311b6c538024338a609f5d101e91157487fe5ddb1c876f1cfef7426cd1f721dd46ade457b47052d7387238c76c11f88288f334caf0549506564f6d11bfadc3e3
7
- data.tar.gz: f6af92b3f7438531b77f81dce0da90e0a0d495bf1a3bcb49929112d267388a68f6897596c3fca580d81360279b41fa0ae378d822022c146890491eb2c92e5810
6
+ metadata.gz: 5c1dc510523d80daee4de75bf4c06b8eba9c0e76938b23aa109ce039e3ed6d74bdfe01fad435d4c8c18f07f0099e58ef5ea8dbb2013109dfec61c754c47df6fa
7
+ data.tar.gz: 6bbedbb413d9149ba205b77bff647b09a69bfb8ce2abb3396e81cb1d2e45a6ae6e8f21be3eeb86306e83c85d8a7a542b7e8ab3ff918178ace885a49ce94fc9b9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 10.8.3
2
+ - Avoid to implicitly set deprecated type to `_doc` when connects to Elasticsearch version 7.x [#994](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/994)
3
+
1
4
  ## 10.8.2
2
5
  - [DOC] Update links to use shared attributes [#985](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/985)
3
6
 
data/docs/index.asciidoc CHANGED
@@ -40,7 +40,8 @@ the website landing page or in the {ref}[Elasticsearch documentation].
40
40
  [NOTE]
41
41
  ================================================================================
42
42
  When connected to Elasticsearch 7.x, modern versions of this plugin
43
- use the required `_doc` document-type when inserting documents.
43
+ don't use the document-type when inserting documents, unless the user
44
+ explicitly sets <<plugins-{type}s-{plugin}-document_type>>.
44
45
 
45
46
  If you are using an earlier version of Logstash and wish to connect to
46
47
  Elasticsearch 7.x, first upgrade Logstash to version 6.8 to ensure it
@@ -417,7 +417,9 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
417
417
  # @param noop_required_client [nil]: required `nil` for legacy reasons.
418
418
  # @return [Boolean]
419
419
  def use_event_type?(noop_required_client)
420
- maximum_seen_major_version < 8
420
+ # always set type for ES <= 6
421
+ # for ES 7 only set it if the user defined it
422
+ (maximum_seen_major_version < 7) || (maximum_seen_major_version == 7 && @document_type)
421
423
  end
422
424
 
423
425
  def install_template
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch'
3
- s.version = '10.8.2'
3
+ s.version = '10.8.3'
4
4
 
5
5
  s.licenses = ['apache-2.0']
6
6
  s.summary = "Stores logs in Elasticsearch"
@@ -4,9 +4,21 @@ 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) { ESHelper.action_for_version(["index", {:_id=>nil, routing_field_name =>nil, :_index=>"logstash-2014.11.17", :_type=> doc_type }, event1]) }
7
+ let(:action1) do
8
+ if ESHelper.es_version_satisfies?(">= 6", "< 7")
9
+ ESHelper.action_for_version(["index", {:_id=>nil, routing_field_name =>nil, :_index=>"logstash-2014.11.17", :_type=> doc_type }, event1])
10
+ else
11
+ ESHelper.action_for_version(["index", {:_id=>nil, routing_field_name =>nil, :_index=>"logstash-2014.11.17" }, event1])
12
+ end
13
+ end
8
14
  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) { ESHelper.action_for_version(["index", {:_id=>nil, routing_field_name =>nil, :_index=>"logstash-2014.11.17", :_type=> doc_type }, event2]) }
15
+ let(:action2) do
16
+ if ESHelper.es_version_satisfies?(">= 6", "< 7")
17
+ ESHelper.action_for_version(["index", {:_id=>nil, routing_field_name =>nil, :_index=>"logstash-2014.11.17", :_type=> doc_type }, event2])
18
+ else
19
+ ESHelper.action_for_version(["index", {:_id=>nil, routing_field_name =>nil, :_index=>"logstash-2014.11.17" }, event2])
20
+ end
21
+ end
10
22
  let(:invalid_event) { LogStash::Event.new("geoip" => { "location" => "notlatlon" }, "@timestamp" => "2014-11-17T20:37:17.223Z") }
11
23
 
12
24
  def mock_actions_with_response(*resp)
@@ -80,10 +80,10 @@ describe LogStash::Outputs::ElasticSearch do
80
80
  describe "building an event action tuple" do
81
81
  context "for 7.x elasticsearch clusters" do
82
82
  let(:maximum_seen_major_version) { 7 }
83
- it "should include '_type'" do
83
+ it "should not include '_type' when 'document_type' is not explicitly defined" do
84
84
  action_tuple = subject.send(:event_action_tuple, LogStash::Event.new("type" => "foo"))
85
85
  action_params = action_tuple[1]
86
- expect(action_params).to include(:_type => "_doc")
86
+ expect(action_params).not_to include(:_type => "_doc")
87
87
  end
88
88
 
89
89
  context "with 'document type set'" do
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: 10.8.2
4
+ version: 10.8.3
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-19 00:00:00.000000000 Z
11
+ date: 2021-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement