Skip to content

Commit 1872668

Browse files
committed
[MODEL] Fixed the incorrect serialization of documents in Importing module for Mongoid
1 parent 29ca681 commit 1872668

File tree

1 file changed

+2
-2
lines changed
  • elasticsearch-model/lib/elasticsearch/model/adapters

1 file changed

+2
-2
lines changed

elasticsearch-model/lib/elasticsearch/model/adapters/mongoid.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ def __find_in_batches(options={}, &block)
7070
items << item
7171

7272
if items.length % options[:batch_size] == 0
73-
batch_for_bulk = items.map { |a| { index: { _id: a.id, data: a.attributes } } }
73+
batch_for_bulk = items.map { |a| { index: { _id: a.id.to_s, data: a.as_indexed_json } } }
7474
yield batch_for_bulk
7575
items = []
7676
end
7777
end
7878

7979
unless items.empty?
80-
batch_for_bulk = items.map { |a| { index: { _id: a.id, data: a.attributes } } }
80+
batch_for_bulk = items.map { |a| { index: { _id: a.id.to_s, data: a.as_indexed_json } } }
8181
yield batch_for_bulk
8282
end
8383
end

0 commit comments

Comments
 (0)