Searchkick: Incremental indexing vs bulk indexing?

Created on 20 Oct 2014  路  4Comments  路  Source: ankane/searchkick

Now that we have 17 million products, indexing takes a long time and if it gets interrupted for any reason, our users suffer.

Is there a way to do say, Product.reindex(:id>100000) - such that data is added to same index vs creating a new index for it?

Any pointers will be greatly appreciated.

Most helpful comment

For future readers, there's now a resume option if your reindex is interrupted.

All 4 comments

Hey @rajatgarg79, you can do:

Product.where("id > 100000").find_in_batches do |batch|
  Product.searchkick_index.import(batch)
end

Much better for larger indices.

@ankane I think such an important feature should be documented somewhere in Readme. We had a hard time trying to figure out why something like some_company.products.reindex was deleting the entire index and creating another just with some_company's products.

If you want I can go ahead and update that for you.

@rajatgarg79 Have a look at this gist also: https://gist.github.com/Chocksy/6efa4833989f51e46fca

For future readers, there's now a resume option if your reindex is interrupted.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carolliu picture carolliu  路  3Comments

mehulkar picture mehulkar  路  5Comments

justi picture justi  路  3Comments

gerrywastaken picture gerrywastaken  路  3Comments

matthewmoss picture matthewmoss  路  4Comments