zelastic 0.5.0 → 0.5.1

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: 04e31f09152172933b5800dfd711a673e6d22c6c
4
- data.tar.gz: d943d84ef9ee7770c4597b4853f75cfd83ec9ab1
3
+ metadata.gz: 7688ccc666c5845c29e20e163691a19f35ee368d
4
+ data.tar.gz: 6de7dbb95705106006706f62d03425345d7509c1
5
5
  SHA512:
6
- metadata.gz: c81a965e8b108be4ff1b4cacdee26fceb6a2164af583e93b06bd9d1919aa9bffb5d29a39220d01c26d0b41f6f0f60da6dffefa6e23b47d4a54edc748344b861e
7
- data.tar.gz: f5ce82aac1b74cbac4526c36bdecf4694b39fc7ac2b1f234298fc635aa883e51f22552954963383b785f15558f27c2e1307d34359c2e5c620ecb34ea300a46ea
6
+ metadata.gz: 113fedb974cb28813e3b8084dbec4dd154b2821afcd0127cbef7b6874b0438b5986fa336bdcc2159502f0869d9f2455ce836907821026393e0814a6e36350456
7
+ data.tar.gz: 8af284f5e38267416325426ea8a72ad62a485698ee51e2e66790bac8590e9e3e6a61c1b85671e31bf0ec35c3d63a9dbbc8c3017abb28ef6d655021b666140975
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ v0.5.1 - Aug 8th, 2018
2
+ ---
3
+
4
+ - Fix re-indexing log output upon initial index creation (#7)
5
+
1
6
  v0.5.0 - Aug 3rd, 2018
2
7
  ---
3
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zelastic (0.5.0)
4
+ zelastic (0.5.1)
5
5
  activesupport
6
6
 
7
7
  GEM
@@ -12,11 +12,7 @@ module Zelastic
12
12
  def create_index(unique_name)
13
13
  index_name = index_name_from_unique(unique_name)
14
14
 
15
- client.indices.create(
16
- index: index_name,
17
- body: config.index_definition
18
- )
19
-
15
+ client.indices.create(index: index_name, body: config.index_definition)
20
16
  client.indices.put_alias(index: index_name, name: config.write_alias)
21
17
  end
22
18
 
@@ -24,9 +20,7 @@ module Zelastic
24
20
  index_name = index_name_from_unique(unique_name)
25
21
 
26
22
  config.data_source.find_in_batches(batch_size: batch_size).with_index do |batch, i|
27
- logger.info(
28
- "ES: (ESTIMATED: #{indexed_percent(batch_size, i + 1)}%) Indexing #{config.type} records"
29
- )
23
+ logger.info(populate_index_log(batch_size: batch_size, batch_number: i + 1))
30
24
  indexer.index_batch(batch, client: client, index_name: index_name)
31
25
  end
32
26
  end
@@ -114,6 +108,15 @@ module Zelastic
114
108
  end
115
109
  end
116
110
 
111
+ def populate_index_log(batch_size:, batch_number:)
112
+ progress = if current_index_exists?
113
+ "ESTIMATED: #{indexed_percent(batch_size, batch_number)}%"
114
+ else
115
+ 'First index'
116
+ end
117
+ "ES: (#{progress}) Indexing #{config.type} records"
118
+ end
119
+
117
120
  def current_index_size
118
121
  @current_index_size ||= client.count(index: config.read_alias, type: config.type)['count']
119
122
  end
@@ -121,5 +124,9 @@ module Zelastic
121
124
  def indexed_percent(batch_size, batch_number)
122
125
  (batch_size * batch_number.to_f / current_index_size * 100).round(2)
123
126
  end
127
+
128
+ def current_index_exists?
129
+ client.indices.exists?(index: config.read_alias)
130
+ end
124
131
  end
125
132
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zelastic
4
- VERSION = '0.5.0'
4
+ VERSION = '0.5.1'
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.5.0
4
+ version: 0.5.1
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-08-03 00:00:00.000000000 Z
11
+ date: 2018-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport