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

The same deprecation notice as the model-level one, but printed from Query#initialize (query.rb:22-28) when `conversions:` is passed to a search call, e.g. `Product.search('banana', conversions: true)`. The option is still honored (and `conversions_v1` is mapped back onto `:conversions`, query.rb:30-32), but Searchkick warns that v2 provides better performance. Output goes through Searchkick.warn as `[searchkick] WARNING: ...`; it is not an exception.

Source

Thrown at lib/searchkick/query.rb:21

    include Enumerable
    extend Forwardable

    @@metric_aggs = [:avg, :cardinality, :max, :min, :sum]

    attr_reader :klass, :term, :options
    attr_accessor :body

    def_delegators :execute, :map, :each, :any?, :empty?, :size, :length, :slice, :[], :to_ary,
      :results, :suggestions, :each_with_hit, :with_details, :aggregations, :aggs,
      :took, :error, :model_name, :entry_name, :total_count, :total_entries,
      :current_page, :per_page, :limit_value, :padding, :total_pages, :num_pages,
      :offset_value, :offset, :previous_page, :prev_page, :next_page, :first_page?, :last_page?,
      :out_of_range?, :hits, :response, :to_a, :first, :scroll, :highlights, :with_highlights,
      :with_score, :misspellings?, :scroll_id, :clear_scroll, :missing_records, :with_hit

    def initialize(klass, term = "*", **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 - [:aggs, :block, :body, :body_options, :boost,
        :boost_by, :boost_by_distance, :boost_by_recency, :boost_where, :conversions, :conversions_v2, :conversions_term, :debug, :emoji, :exclude, :explain,
        :fields, :highlight, :includes, :index_name, :indices_boost, :knn, :limit, :load,
        :match, :misspellings, :models, :model_includes, :offset, :opaque_id, :operator, :order, :padding, :page, :per_page, :profile,
        :request_params, :routing, :scope_results, :scroll, :select, :similar, :smart_aggs, :suggest, :total_entries, :track, :type, :where]
      raise ArgumentError, "unknown keywords: #{unknown_keywords.join(", ")}" if unknown_keywords.any?

      term = term.to_s

      if options[:emoji]
        term = EmojiParser.parse_unicode(term) { |e| " #{e.name.tr('_', ' ')} " }.strip
      end

View on GitHub (pinned to 93e901a75b)

Solutions

  1. Rename the query option to `conversions_v1: true` to keep behavior and silence the warning
  2. Migrate the model to `conversions_v2: [...]` fields, reindex, and drop query-level `conversions` - boosting then comes from the v2 subfield automatically
  3. Remove the per-query option if conversion boosting is not needed

Example fix

# before
Product.search("banana", conversions: true)

# after
Product.search("banana", conversions_v1: true)
# or, once the model defines conversions_v2 and data is reindexed:
Product.search("banana")
Defensive patterns

Strategy: fallback

Validate before calling

# Normalize options in one place before they reach Searchkick
def product_search(term, **options)
  options[:conversions_v1] = options.delete(:conversions) if options.key?(:conversions)
  Product.search(term, **options)
end

Prevention

When it happens

Trigger: Every search call passing the option: `Product.search('banana', conversions: true)` or `conversions: [:field]`, including via search scopes/relations. Fires once per query construction, so hot paths warn on every request after upgrading Searchkick to 5+.

Common situations: Per-query personalized search tuned with legacy options; codebases upgrading Searchkick where old calls still pass `conversions:`; log noise from warnings emitted on every search request until migrated.

Related errors


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