Skip to content

Elasticsearch model import method conflicts with Rails 6.1 activerecord import method #1009

Open
@robmathews

Description

@robmathews

Hi there! Migrating some code from rails 5.2 to rails 6.1.4 and this code is failing:

objs.import(refresh: true)

with a traceback like this:

vendor/bundle/ruby/3.0.0/gems/activerecord-import-1.2.0/lib/activerecord-import/import.rb:648:in `import_helper': Invalid arguments! (ArgumentError)

which seems to be because rails has natively imported the bulk import feature.

I tried working around this by calling

objs.__elasticsearch__.import(refresh: true)

but instead that cause ActiveRecords import method to still be called, and that calls some serialization code, which ends badly with a "document too large' error, like this:

Elasticsearch::Transport::Transport::Errors::RequestEntityTooLarge

so it doesn't work.

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