Method: Elastictastic::BulkPersistenceStrategy#update
- Defined in:
- lib/elastictastic/bulk_persistence_strategy.rb
#update(instance, &block) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/elastictastic/bulk_persistence_strategy.rb', line 38 def update(instance, &block) block ||= DEFAULT_HANDLER instance.pending_save! add( instance.index, instance.id, { 'index' => bulk_identifier_for_instance(instance) }, instance.elasticsearch_doc ) do |response| if response['index']['error'] block.call(ServerError[response['index']['error']]) else instance.version = response['index']['_version'] block.call end end end |