metacrunch-elasticsearch 4.0.1 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +0 -1
- data/lib/metacrunch/elasticsearch/destination.rb +6 -14
- data/lib/metacrunch/elasticsearch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a464a5a3f84b26ffa4009cfee481605da96c875d
|
4
|
+
data.tar.gz: 8e00dd3a71cc2112443672994e61e98f174ef9ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 120cff49cbfe64a633be9aba66eb470a83b27a4cdb007cd6d4df8fea29c2c7f0d38f42b4ecf52b07ba5699a3b7052aa025915c778dfdaf5bf9897dd6b5ff0ba3
|
7
|
+
data.tar.gz: 7252049dc4fb97f097af07378af81e6562de53e455dc5a979072c7ce52193c3611fc2994c4c912cae9f3ceaa252c65fa3edf442fba1de80f85434897b11639cf
|
data/Readme.md
CHANGED
@@ -94,7 +94,6 @@ destination Metacrunch::Elasticsearch::Destination.new(elasticsearch [, OPTIONS]
|
|
94
94
|
|
95
95
|
**Options**
|
96
96
|
|
97
|
-
* `:raise_on_result_errors`: If set to `true` an error is raised if one of the bulk operations return with an error. Defaults to `false`.
|
98
97
|
* `:result_callback`: You can set a `Proc` that gets called with the result from the bulk operation. Defaults to `nil`.
|
99
98
|
* `:bulk_options`: A hash of options for the Eleasticsearch bulk API as described [here](https://github.com/elastic/elasticsearch-ruby/blob/master/elasticsearch-api/lib/elasticsearch/api/actions/bulk.rb). Setting `body` here will be ignored. Defaults to `{}`.
|
100
99
|
|
@@ -4,7 +4,7 @@ module Metacrunch
|
|
4
4
|
class Elasticsearch::Destination
|
5
5
|
|
6
6
|
DEFAULT_OPTIONS = {
|
7
|
-
raise_on_result_errors: false,
|
7
|
+
raise_on_result_errors: false, # deprecated
|
8
8
|
result_callback: nil,
|
9
9
|
bulk_options: {}
|
10
10
|
}
|
@@ -12,6 +12,11 @@ module Metacrunch
|
|
12
12
|
def initialize(elasticsearch_client, options = {})
|
13
13
|
@client = elasticsearch_client
|
14
14
|
@options = DEFAULT_OPTIONS.deep_merge(options)
|
15
|
+
|
16
|
+
@deprecator = ActiveSupport::Deprecation.new("5.0.0", "metacrunch-elasticsearch")
|
17
|
+
if @options[:raise_on_result_errors]
|
18
|
+
@deprecator.deprecation_warning("Option :raise_on_result_errors")
|
19
|
+
end
|
15
20
|
end
|
16
21
|
|
17
22
|
def write(data)
|
@@ -22,9 +27,6 @@ module Metacrunch
|
|
22
27
|
bulk_options[:body] = data
|
23
28
|
result = @client.bulk(bulk_options)
|
24
29
|
|
25
|
-
# Raise an exception if one of the results produced an error and the user wants to know about it
|
26
|
-
raise DestinationError.new(errors: result["errors"]) if result["errors"] && @options[:raise_on_result_errors]
|
27
|
-
|
28
30
|
# if the user provided a callback proc, call it
|
29
31
|
@options[:result_callback].call(result) if @options[:result_callback]&.respond_to?(:call)
|
30
32
|
end
|
@@ -34,14 +36,4 @@ module Metacrunch
|
|
34
36
|
end
|
35
37
|
|
36
38
|
end
|
37
|
-
|
38
|
-
class Elasticsearch::DestinationError < StandardError
|
39
|
-
|
40
|
-
attr_reader :errors
|
41
|
-
|
42
|
-
def initialize(msg = nil, errors:)
|
43
|
-
@errors = errors
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metacrunch-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- René Sprotte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|