lib/elasticity/bulk.rb in es-elasticity-0.14.1 vs lib/elasticity/bulk.rb in es-elasticity-1.0.0.jhumphreys
- old
+ new
@@ -1,22 +1,24 @@
+# frozen_string_literal: true
+
module Elasticity
class Bulk
def initialize(client)
@client = client
@operations = []
end
- def index(index_name, type, id, attributes)
- @operations << { index: { _index: index_name, _type: type, _id: id, data: attributes }}
+ def index(index_name, id, attributes)
+ @operations << { index: { _index: index_name, _id: id, data: attributes }}
end
- def update(index_name, type, id, attributes)
- @operations << { update: { _index: index_name, _type: type, _id: id, data: attributes }}
+ def update(index_name, id, attributes)
+ @operations << { update: { _index: index_name, _id: id, data: attributes }}
end
- def delete(index_name, type, id)
- @operations << { delete: { _index: index_name, _type: type, _id: id }}
+ def delete(index_name, id)
+ @operations << { delete: { _index: index_name, _id: id }}
end
def execute
@client.bulk(body: @operations)
end
@@ -25,40 +27,40 @@
def initialize(client, index_name)
super(client)
@index_name = index_name
end
- def index(type, id, attributes)
- super(@index_name, type, id, attributes)
+ def index(id, attributes)
+ super(@index_name, id, attributes)
end
- def update(type, id, attributes)
- super(@index_name, type, id, attributes)
+ def update(id, attributes)
+ super(@index_name, id, attributes)
end
- def delete(type, id)
- super(@index_name, type, id)
+ def delete(id)
+ super(@index_name, id)
end
end
class Alias < Bulk
def initialize(client, update_alias, delete_indexes)
super(client)
@update_alias = update_alias
@delete_indexes = delete_indexes
end
- def index(type, id, attributes)
- super(@update_alias, type, id, attributes)
+ def index(id, attributes)
+ super(@update_alias, id, attributes)
end
- def update(type, id, attributes)
- super(@update_alias, type, id, attributes)
+ def update(id, attributes)
+ super(@update_alias, id, attributes)
end
- def delete(type, id)
+ def delete(id)
@delete_indexes.each do |index|
- super(index, type, id)
+ super(index, id)
end
end
end
end
end