elasticsearch-rails icon indicating copy to clipboard operation
elasticsearch-rails copied to clipboard

Model#import method name clashes with activerecord-import library

Open scarrick68 opened this issue 4 years ago • 2 comments

The import method is shadowed by activerecord-import which results in this argument error: ArgumentError: Invalid arguments! from /some_local_path/activerecord-import-1.2.0/lib/activerecord-import/import.rb:648:in import_helper'`

Ruby doesn't support method overloading so it doesn't recognize any other definition. I'm guessing only the most recent for that class / module. Just wanted to point this out for anyone who runs into the same issue since AR import gem is pretty popular, 47 MM downloads.

My hot fix was to remove AR import, bundle and run the import. This won't work for anyone who runs a periodic import job.

I'd be happy to alias the method and make a PR.

scarrick68 avatar Oct 08 '21 19:10 scarrick68

Hi I have used elasticsearch proxy __elasticsearch__ and works perfect)

for example: User.elasticsearch.import

if you need to import specific models you can use query parameter User.elasticsearch.import query: -> { User.where(id: ids) }

Maybe it will help you

Quicks avatar Nov 05 '21 10:11 Quicks