lib/estella/helpers.rb in estella-5.0.1 vs lib/estella/helpers.rb in estella-6.0.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module Estella
module Helpers
extend ActiveSupport::Concern
@@types = []
@@ -59,11 +61,11 @@
find(batch_of_ids).map(&:es_transform)
end
def bulk_index(batch_of_ids)
create_index! unless index_exists?
- __elasticsearch__.client.bulk index: index_name, type: model_name.element, body: batch_to_bulk(batch_of_ids)
+ __elasticsearch__.client.bulk index: index_name, type: document_type, body: batch_to_bulk(batch_of_ids)
end
# @return true if the index exists
def index_exists?
__elasticsearch__.client.indices.exists index: index_name
@@ -72,10 +74,13 @@
def delete_index!
__elasticsearch__.client.indices.delete index: index_name
end
def create_index!
- __elasticsearch__.client.indices.create index: index_name, body: { settings: settings.to_hash, mappings: mappings.to_hash }
+ __elasticsearch__.client.indices.create index: index_name,
+ body: {
+ settings: settings.to_hash, mappings: mappings.to_hash
+ }
end
def reload_index!
delete_index! if index_exists?
create_index!