sequel-elasticsearch 0.4.7 → 0.4.8

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
  SHA256:
3
- metadata.gz: 8f6e85a7a9a92736d74000717cf12de5fb7b42f20e839a0d57611e79ca014f52
4
- data.tar.gz: 1e049bd725b6a164747e1982d119a9adc214788dc5a1624fafcdfcd612e7d767
3
+ metadata.gz: 7d297d1a447dae85be685cef2d12b2f38ba9734259318b1bb7b2bd2458b6325e
4
+ data.tar.gz: 61aef4399f9f5faeb8bcb37ac74dedf386277d533dfb75996d7744fa1a4ab0f4
5
5
  SHA512:
6
- metadata.gz: a72f7253761846209b0b86f704cb44e57be9d0d2561ab78b92bdd6912799ecc8e424c4779c252bf67da61aa62003c1f5bc9dcf0043ca1e3fee618ab3de9b89b3
7
- data.tar.gz: 14de18c7db260ad3615a732de6338f7402aaedd34721e3826ba4cb3f7faa052e615080fcafef2e5155c2977cfd44a3bfaac5628268a07b9784446e624c40185a
6
+ metadata.gz: f6d774d669be05c6b1030df3ca8ba83a2ce0ee62e3685d9b8d8cb0163a3b542584fb10f09569046529dd5795de3b5efb5cd1f7079009e68df6d867324dc498bd
7
+ data.tar.gz: b18e6af022f73da17285030c2a7ff880eec87b8df183481efbb8e49915cdff03ad2d5e1294d1092fc8fc9a5c5590ede4649f6fe9c9f9f6e36d043fc6d12b52ef
@@ -92,23 +92,23 @@ module Sequel
92
92
 
93
93
  # Index all the documents
94
94
  body = []
95
- dataset.all.each do |row|
96
- body << {
97
- update: {
98
- _index: index_name,
99
- _type: elasticsearch_type,
100
- _id: row.document_id,
101
- data: { doc: row.indexed_values, doc_as_upsert: true }
95
+ dataset.each_page(batch_size) do |ds|
96
+ body = []
97
+ ds.all.each do |row|
98
+ print '.'
99
+ body << {
100
+ update: {
101
+ _index: index_name,
102
+ _type: elasticsearch_type,
103
+ _id: row.document_id,
104
+ data: { doc: row.indexed_values, doc_as_upsert: true }
105
+ }
102
106
  }
103
- }
104
- print '.'
105
- next unless body.count >= batch_size
107
+ end
106
108
  puts '/'
107
-
108
109
  es_client.bulk body: body
109
- body = []
110
+ body = nil
110
111
  end
111
- es_client.bulk body: body if body.count.positive?
112
112
  end
113
113
 
114
114
  # Creates a new index in Elasticsearch from the specified dataset, as
@@ -4,6 +4,6 @@ module Sequel
4
4
  # See https://jrgns.github.io/sequel-elasticsearch
5
5
  module Elasticsearch
6
6
  # The Gem's version.
7
- VERSION = '0.4.7'.freeze
7
+ VERSION = '0.4.8'.freeze
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurgens du Toit
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-30 00:00:00.000000000 Z
11
+ date: 2019-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: elasticsearch