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 +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/zelastic/index_manager.rb +15 -8
- 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: 7688ccc666c5845c29e20e163691a19f35ee368d
|
4
|
+
data.tar.gz: 6de7dbb95705106006706f62d03425345d7509c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 113fedb974cb28813e3b8084dbec4dd154b2821afcd0127cbef7b6874b0438b5986fa336bdcc2159502f0869d9f2455ce836907821026393e0814a6e36350456
|
7
|
+
data.tar.gz: 8af284f5e38267416325426ea8a72ad62a485698ee51e2e66790bac8590e9e3e6a61c1b85671e31bf0ec35c3d63a9dbbc8c3017abb28ef6d655021b666140975
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -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
|
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.5.
|
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-
|
11
|
+
date: 2018-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|