ankane/searchkick · warning

The `conversions` option is deprecated in favor of `conversi

Error message

The `conversions` option is deprecated in favor of `conversions_v2`, which provides much better search performance. Upgrade to `conversions_v2` or rename `conversions` to `conversions_v1`

What it means

A deprecation notice printed via Searchkick.warn as `[searchkick] WARNING: ...` (searchkick.rb:280-282) when a model is declared with the legacy `searchkick conversions: ...` option (model.rb:8-9). Legacy conversions carry a query-to-count hash per document for personalized boosting; `conversions_v2` keeps that boost data in a dedicated subfield with much better search performance. It is not an exception - the option still works, and `conversions_v1` is the explicit alias that keeps the old behavior and silences the warning (model.rb:11-13).

Source

Thrown at lib/searchkick/model.rb:7

module Searchkick
  module Model
    def searchkick(**options)
      options = Searchkick.model_options.deep_merge(options)

      if options[:conversions]
        Searchkick.warn("The `conversions` option is deprecated in favor of `conversions_v2`, which provides much better search performance. Upgrade to `conversions_v2` or rename `conversions` to `conversions_v1`")
      end

      if options.key?(:conversions_v1)
        options[:conversions] = options.delete(:conversions_v1)
      end

      unknown_keywords = options.keys - [:_all, :_type, :batch_size, :callbacks, :callback_options, :case_sensitive, :conversions, :conversions_v2, :deep_paging, :default_fields,
        :filterable, :geo_shape, :highlight, :ignore_above, :index_name, :index_prefix, :inheritance, :job_options, :knn, :language,
        :locations, :mappings, :match, :max_result_window, :merge_mappings, :routing, :searchable, :search_synonyms, :settings, :similarity,
        :special_characters, :stem, :stemmer, :stem_conversions, :stem_exclusion, :stemmer_override, :suggest, :synonyms, :text_end,
        :text_middle, :text_start, :unscope, :word, :word_end, :word_middle, :word_start]
      raise ArgumentError, "unknown keywords: #{unknown_keywords.join(", ")}" if unknown_keywords.any?

      raise "Only call searchkick once per model" if respond_to?(:searchkick_index)

      Searchkick.models << self

      options[:_type] ||= -> { searchkick_index.klass_document_type(self, true) }

View on GitHub (pinned to 93e901a75b)

Solutions

  1. Keep legacy behavior and silence the warning by renaming to `conversions_v1: [:conversions]`
  2. Migrate to v2: add `conversions_v2: [:conversions]` fed from your conversion source (e.g. Searchjoy data), run both fields during zero-downtime (`searchkick conversions: [:conversions], conversions_v2: [:conversions_v2]`), reindex, then drop the old field
  3. Remove the option entirely if you no longer use conversion boosting

Example fix

# before
class Product < ApplicationRecord
  searchkick conversions: [:conversions]

  def search_data
    { name: name, conversions: conversion_counts }
  end
end

# after (legacy behavior, warning silenced)
class Product < ApplicationRecord
  searchkick conversions_v1: [:conversions]

  def search_data
    { name: name, conversions: conversion_counts }
  end
end
Defensive patterns

Strategy: validation

Validate before calling

# config/initializers/searchkick_audit.rb - fail boot/CI on the legacy option
Dir[Rails.root.join("app/models/**/*.rb")].each do |path|
  if File.read(path) =~ /searchkick[^#]*[^_]\w*conversions:/
    raise "Deprecated `conversions:` in #{path} - use conversions_v1 or migrate to conversions_v2"
  end
end

Prevention

When it happens

Trigger: A model declared with `searchkick conversions: [:conversions]`, the pre-5.x style from older READMEs and tutorials. The warning fires at class load time - on Rails boot, eager loading, or the first search - after upgrading Searchkick to 5+.

Common situations: Upgrading Searchkick 4 to 5+ where `conversions` was the documented personalization API; copying conversion-boosting code from old blog posts; the warning appearing on every deploy/boot and polluting logs.

Related errors


AI-assisted analysis of ankane/searchkick@93e901a75b (2026-08-21). Data as JSON: /api/errors/b54a3b2d6d146e57. Report an issue: GitHub.