Skip to content

NoMethodError: undefined method `find' for nil:NilClass #915

Open
@Sexual

Description

@Sexual

In production, we can't search in multiple models. it works fine locally.

Elasticsearch version v7.4.2

    search_payload = {
      query: {
        bool: {
          must: [
            {
              multi_match: {
                query: params[:search].to_s.downcase
              }
            }
          ],
          must_not: {
            exists: {
              field: 'deleted_at'
            }
          },
          filter: [
            {
              term: {
                user_: user_shop.id,
              }
            }
          ]
        }
      },
      size: 7
    }

records = Elasticsearch::Model.search(search_payload, [Order, Product]).records
records.json
NoMethodError: undefined method `find' for nil:NilClass
from /usr/local/bundle/gems/elasticsearch-model-7.0.0/lib/elasticsearch/model/adapters/multiple.rb:79:in `__records_for_klass'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions