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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19307349dedf8d7ea1ed2c3bea0f21aaa07ee4ee
4
- data.tar.gz: c2ffdf1cea48bcc8275d092298dbca72cf97a693
3
+ metadata.gz: 6e08c19cd16316a3fb4dc38124ae42d3293d4e9b
4
+ data.tar.gz: ce4a3323ce0108383274d47a72f1d1c6fba3b7ea
5
5
  SHA512:
6
- metadata.gz: 104a24a17ebfe4e227cd4b993b9d3c47c601b70c95c6fe1adc5ed757310e8f8af5eb2b9d40ead0e7eb3fe580d6fb3c0555f42618025ad23145dbbe5b7321dc4e
7
- data.tar.gz: 2e629f323d6ebc0b9003980348a45754d1a03043a77d1fb92f20a9e67c3673b4cd24fc7076b61ffba772144dc952162e015f763a5a21f2687a9246fc78f591ff
6
+ metadata.gz: 68de56328d14fcd6f71c1af59159fb8ccb36f2adf9156292b822bb9a7253b86ff9b1730f5bce1a03bcf0dc27be38b8d9f4d4530528bbd8743997d5a42717ec72
7
+ data.tar.gz: 6f6189e1fd0489359a6a556f6724ac3d8e9806853feafe9e3a5a4e8fb213887d82fc70afbaecdaedb624b2e76a57af6fd5f07d2c9882881d9d63ccb3348e4c0d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zelastic (0.3.1)
4
+ zelastic (0.3.2)
5
5
  activesupport
6
6
 
7
7
  GEM
@@ -6,7 +6,9 @@ module Zelastic
6
6
  attr_reader :errors
7
7
 
8
8
  def initialize(result)
9
- @errors = result['items'].map { |item| item['error'] }.compact
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.each do |client|
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
- config.clients.map do |client|
97
- indices = Array(index_name || write_indices(client))
98
+ clients.map do |current_client|
99
+ indices = Array(index_name || write_indices(current_client))
98
100
 
99
- commands = indices.map { |index_name| yield(index) }
101
+ commands = indices.flat_map { |index| yield(index) }
100
102
 
101
- client.bulk(body: commands).tap do |result|
103
+ current_client.bulk(body: commands).tap do |result|
102
104
  raise IndexingError, result if result['errors']
103
105
  end
104
106
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zelastic
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  end
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.1
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-24 00:00:00.000000000 Z
11
+ date: 2018-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport