Method: SearchFlip::Index::ClassMethods#index
- Defined in:
- lib/search_flip/index.rb
#index(scope, options = {}, additional_index_options = {}) ⇒ Object
Indexes the given record set, array of records or individual record. A record set usually is an ActiveRecord::Relation, but can be any other ORM as well. Uses the Elasticsearch bulk API no matter what is provided. Refreshes the index if auto_refresh is enabled. Raises SearchFlip::ResponseError in case any errors occur.
534 535 536 537 538 539 540 541 542 |
# File 'lib/search_flip/index.rb', line 534 def index(scope, = {}, = {}) bulk do |indexer| each_record(scope, index_scope: true) do |object| indexer.index record_id(object), serialize(object), (object).merge() end end scope end |