Permalink
314c096 Mar 2, 2018
1 contributor

Users who have contributed to this file

58 lines (38 sloc) 1.32 KB

Searchkick 3 Upgrade

Before You Upgrade

Searchkick 3 no longer uses types, since they are deprecated in Elasticsearch 6.

If you use inheritance, add to your parent model:

class Animal < ApplicationRecord
  searchkick inheritance: true
end

And do a full reindex before upgrading.

Upgrading

Update your Gemfile:

gem 'searchkick', '~> 3'

And run:

bundle update searchkick

We recommend you don’t stem conversions anymore, so conversions for pepper don’t affect peppers, but if you want to keep the old behavior, use:

Searchkick.model_options = {
  stem_conversions: true
}

Searchkick 3 disables the _all field by default, since Elasticsearch 6 removes the ability to reindex with it. If you’re on Elasticsearch 5 and still need it, add to your model:

class Product < ApplicationRecord
  searchkick _all: true
end

If you use record.reindex_async or record.reindex(async: true), replace it with:

record.reindex(mode: :async)

If you use log: true with boost_by, replace it with modifier: "ln2p".

If you use the body option and have warnings about incompatible options, remove them, as they now throw an ArgumentError.

Check out the changelog for the full list of changes.