class Elastics::Client::Bulk::Builder

Attributes

actions[R]

Public Class Methods

new() click to toggle source
# File lib/elastics/client/bulk.rb, line 15
def initialize
  @actions = []
end

Public Instance Methods

add_action(action, params, data = nil) click to toggle source
# File lib/elastics/client/bulk.rb, line 27
def add_action(action, params, data = nil)
  params = {_id: params} unless params.is_a?(Hash)
  @actions << {action => params}
  @actions << data if data
end
any?() click to toggle source
# File lib/elastics/client/bulk.rb, line 19
def any?
  @actions.any?
end
body() click to toggle source
# File lib/elastics/client/bulk.rb, line 23
def body
  @actions.map(&:to_json).join("\n".freeze) + "\n"
end
delete(params) click to toggle source
# File lib/elastics/client/bulk.rb, line 43
def delete(params)
  add_action(:delete, params)
end
update_doc(params, fields) click to toggle source
# File lib/elastics/client/bulk.rb, line 39
def update_doc(params, fields)
  update(params, doc: fields)
end