lib/agnostic_backend/elasticsearch/indexer.rb in agnostic_backend-1.0.2 vs lib/agnostic_backend/elasticsearch/indexer.rb in agnostic_backend-1.0.3
- old
+ new
@@ -1,16 +1,10 @@
module AgnosticBackend
module Elasticsearch
class Indexer < AgnosticBackend::Indexer
include AgnosticBackend::Utilities
- private
-
- def client
- index.client
- end
-
def publish(document)
client.send_request(:put,
path: "/#{index.index_name}/#{index.type}/#{document["id"]}",
body: document)
end
@@ -24,9 +18,14 @@
# if at least one indexing attempt fails, raise the red flag
raise IndexingError.new, "Error in bulk upload" if body["errors"]
response
end
+ private
+
+ def client
+ index.client
+ end
def prepare(document)
raise IndexingError.new, "Document does not have an ID field" unless document["id"].present?
document
end