class Elasticity::Bulk
Public Class Methods
new(client)
click to toggle source
# File lib/elasticity/bulk.rb, line 3 def initialize(client) @client = client @operations = [] end
Public Instance Methods
delete(index_name, type, id)
click to toggle source
# File lib/elasticity/bulk.rb, line 16 def delete(index_name, type, id) @operations << { delete: { _index: index_name, _type: type, _id: id }} end
execute()
click to toggle source
# File lib/elasticity/bulk.rb, line 20 def execute @client.bulk(body: @operations) end
index(index_name, type, id, attributes)
click to toggle source
# File lib/elasticity/bulk.rb, line 8 def index(index_name, type, id, attributes) @operations << { index: { _index: index_name, _type: type, _id: id, data: attributes }} end
update(index_name, type, id, attributes)
click to toggle source
# File lib/elasticity/bulk.rb, line 12 def update(index_name, type, id, attributes) @operations << { update: { _index: index_name, _type: type, _id: id, data: attributes }} end