lib/mongoid/elasticsearch/es.rb in mongoid-elasticsearch-0.4.2 vs lib/mongoid/elasticsearch/es.rb in mongoid-elasticsearch-0.4.3
- old
+ new
@@ -29,9 +29,10 @@
{ index: {data: obj.as_indexed_json}.merge(_id: obj.id.to_s) }
else
nil
end
end.reject { |obj| obj.nil? }
+ next if docs.empty?
client.bulk({body: docs}.merge(type_options))
if block_given?
yield steps, step
end
end