zelastic 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/zelastic/indexer.rb +9 -7
- data/lib/zelastic/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: 6e08c19cd16316a3fb4dc38124ae42d3293d4e9b
|
4
|
+
data.tar.gz: ce4a3323ce0108383274d47a72f1d1c6fba3b7ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68de56328d14fcd6f71c1af59159fb8ccb36f2adf9156292b822bb9a7253b86ff9b1730f5bce1a03bcf0dc27be38b8d9f4d4530528bbd8743997d5a42717ec72
|
7
|
+
data.tar.gz: 6f6189e1fd0489359a6a556f6724ac3d8e9806853feafe9e3a5a4e8fb213887d82fc70afbaecdaedb624b2e76a57af6fd5f07d2c9882881d9d63ccb3348e4c0d
|
data/Gemfile.lock
CHANGED
data/lib/zelastic/indexer.rb
CHANGED
@@ -6,7 +6,9 @@ module Zelastic
|
|
6
6
|
attr_reader :errors
|
7
7
|
|
8
8
|
def initialize(result)
|
9
|
-
@errors = result['items'].map
|
9
|
+
@errors = result['items'].map do |item|
|
10
|
+
item['error'] || item.fetch('index', {})['error']
|
11
|
+
end.compact
|
10
12
|
super("Errors indexing: #{errors.join(', ')}")
|
11
13
|
end
|
12
14
|
end
|
@@ -32,7 +34,7 @@ module Zelastic
|
|
32
34
|
version = current_version
|
33
35
|
|
34
36
|
execute_bulk do |index_name|
|
35
|
-
index_command(index: index_name, version: version, record: record)
|
37
|
+
[index_command(index: index_name, version: version, record: record)]
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
@@ -59,7 +61,7 @@ module Zelastic
|
|
59
61
|
def delete_by_query(query)
|
60
62
|
logger.info('ES: Deleting batch records')
|
61
63
|
|
62
|
-
config.clients.
|
64
|
+
config.clients.map do |client|
|
63
65
|
client.delete_by_query(index: config.write_alias, body: { query: query })
|
64
66
|
end
|
65
67
|
end
|
@@ -93,12 +95,12 @@ module Zelastic
|
|
93
95
|
def execute_bulk(client: nil, index_name: nil)
|
94
96
|
clients = Array(client || config.clients)
|
95
97
|
|
96
|
-
|
97
|
-
indices = Array(index_name || write_indices(
|
98
|
+
clients.map do |current_client|
|
99
|
+
indices = Array(index_name || write_indices(current_client))
|
98
100
|
|
99
|
-
commands = indices.
|
101
|
+
commands = indices.flat_map { |index| yield(index) }
|
100
102
|
|
101
|
-
|
103
|
+
current_client.bulk(body: commands).tap do |result|
|
102
104
|
raise IndexingError, result if result['errors']
|
103
105
|
end
|
104
106
|
end
|
data/lib/zelastic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zelastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- carwow Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|