Skip to main content
Use this page when you need the quickest way to index a collection.
Define index do … map in your model first. See Indexer.

Fastest ways to index

1

CLI (single collection)

rails 'search_engine:index:rebuild[books]'
2

Ruby (single or multiple collections)

SearchEngine::Book.index_collection
SearchEngine::Bulk.index_collections(:books, :publishers)
SearchEngine::Bulk.index_all
Use partition: to rebuild specific partitions.

Optional: auto-sync on changes

app/models/book.rb
class Book < ApplicationRecord
  include SearchEngine::ActiveRecordSyncable

  search_engine_syncable on: %i[create update destroy]
end

Next steps