Class: SearchFlip::Bulk Private
- Inherits:
-
Object
- Object
- SearchFlip::Bulk
- Defined in:
- lib/search_flip/bulk.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The SearchFlip::Bulk class implements the bulk support, ie it collects single requests and emits batches of requests.
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
- #ignore_errors ⇒ Object readonly private
- #options ⇒ Object readonly private
- #url ⇒ Object readonly private
Instance Method Summary collapse
-
#create(id, object, options = {}) ⇒ Object
private
Adds a create request to the bulk batch.
-
#delete(id, options = {}) ⇒ Object
private
Adds a delete request to the bulk batch.
-
#index(id, object, options = {}) ⇒ Object
private
Adds an index request to the bulk batch.
-
#initialize(url, options = {}) {|_self| ... } ⇒ Bulk
constructor
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.
-
#update(id, object, options = {}) ⇒ Object
private
Adds a update request to the bulk batch.
Constructor Details
#initialize(url, options = {}) {|_self| ... } ⇒ Bulk
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
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.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/search_flip/bulk.rb', line 52 def initialize(url, = {}) @url = url @options = @http_client = [:http_client] || SearchFlip::HTTPClient.new @ignore_errors = Array([:ignore_errors] || []).to_set @bulk_limit = [:bulk_limit] || SearchFlip::Config[:bulk_limit] @bulk_max_mb = [:bulk_max_mb] || SearchFlip::Config[:bulk_max_mb] @bulk_max_bytes = @bulk_max_mb * 1024 * 1024 init yield self upload if @num > 0 end |
Instance Attribute Details
#ignore_errors ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 |
# File 'lib/search_flip/bulk.rb', line 18 def ignore_errors @ignore_errors end |
#options ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 |
# File 'lib/search_flip/bulk.rb', line 18 def @options end |
#url ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 |
# File 'lib/search_flip/bulk.rb', line 18 def url @url end |
Instance Method Details
#create(id, object, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds a create request to the bulk batch.
102 103 104 |
# File 'lib/search_flip/bulk.rb', line 102 def create(id, object, = {}) perform(:create, id, SearchFlip::JSON.generate(object), ) end |
#delete(id, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds a delete request to the bulk batch.
127 128 129 |
# File 'lib/search_flip/bulk.rb', line 127 def delete(id, = {}) perform(:delete, id, nil, ) end |
#index(id, object, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds an index request to the bulk batch.
79 80 81 |
# File 'lib/search_flip/bulk.rb', line 79 def index(id, object, = {}) perform(:index, id, SearchFlip::JSON.generate(object), ) end |
#update(id, object, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds a update request to the bulk batch.
115 116 117 |
# File 'lib/search_flip/bulk.rb', line 115 def update(id, object, = {}) perform(:update, id, SearchFlip::JSON.generate(object), ) end |