Method: SearchFlip::Index::ClassMethods#create

Defined in:
lib/search_flip/index.rb

#create(scope, options = {}, additional_index_options = {}) ⇒ Object

Indexes the given record set, array of records or individual record using Elasticsearch’s create operation via the Bulk API, such that the request will fail if a record with a particular primary key already exists in Elasticsearch.



552
553
554
555
556
557
558
559
560
# File 'lib/search_flip/index.rb', line 552

def create(scope, options = {}, additional_index_options = {})
  bulk options do |indexer|
    each_record(scope, index_scope: true) do |object|
      indexer.create record_id(object), serialize(object), index_options(object).merge(additional_index_options)
    end
  end

  scope
end