lib/search_flip/bulk.rb in search_flip-2.0.0.beta5 vs lib/search_flip/bulk.rb in search_flip-2.0.0.beta6
- old
+ new
@@ -1,7 +1,9 @@
module SearchFlip
+ # @api private
+ #
# The SearchFlip::Bulk class implements the bulk support, ie it collects
# single requests and emits batches of requests.
#
# @example
# SearchFlip::Bulk.new "http://127.0.0.1:9200/index/type/_bulk" do |bulk|
@@ -14,10 +16,12 @@
class Bulk
class Error < StandardError; end
attr_reader :url, :options, :ignore_errors
+ # @api private
+ #
# Builds and yields a new Bulk object, ie initiates the buffer, yields,
# sends batches of records each time the buffer is full, and sends a final
# batch after the yielded code returns and there are still documents
# present within the buffer.
#
@@ -31,12 +35,14 @@
# # ...
# end
#
# @param url [String] The endpoint to send bulk requests to
# @param options [Hash] Options for the bulk requests
- # @option options batch_size [Fixnum] The maximum number of documents per bulk
+ # @option options bulk_limit [Fixnum] The maximum number of documents per bulk
# request
+ # @option bulk_max_mb [Fixnum] The maximum payload size in megabytes per
+ # bulk request
# @option options ignore_errors [Array, Fixnum] Errors that should be
# ignored. If you eg want to ignore errors resulting from conflicts,
# you can specify to ignore 409 here.
# @option options raise [Boolean] If you want the bulk requests to never
# raise any exceptions (fire and forget), you can pass false here.
@@ -60,10 +66,12 @@
yield self
upload if @num > 0
end
+ # @api private
+ #
# Adds an index request to the bulk batch.
#
# @param id [Fixnum, String] The document/record id
# @param json [String] The json document
# @param options [options] Options for the index request, like eg routing
@@ -71,18 +79,22 @@
def index(id, object, options = {})
perform :index, id, SearchFlip::JSON.generate(object), options
end
+ # @api private
+ #
# Adds an index request to the bulk batch
#
# @see #index
def import(*args)
index(*args)
end
+ # @api private
+ #
# Adds a create request to the bulk batch.
#
# @param id [Fixnum, String] The document/record id
# @param json [String] The json document
# @param options [options] Options for the index request, like eg routing
@@ -90,10 +102,12 @@
def create(id, object, options = {})
perform :create, id, SearchFlip::JSON.generate(object), options
end
+ # @api private
+ #
# Adds a update request to the bulk batch.
#
# @param id [Fixnum, String] The document/record id
# @param json [String] The json document
# @param options [options] Options for the index request, like eg routing
@@ -101,9 +115,11 @@
def update(id, object, options = {})
perform :update, id, SearchFlip::JSON.generate(object), options
end
+ # @api private
+ #
# Adds a delete request to the bulk batch.
#
# @param id [Fixnum, String] The document/record id
# @param options [options] Options for the index request, like eg routing
# and versioning