-
Notifications
You must be signed in to change notification settings - Fork 801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow custom transformations to be defined for bulk imports. #113
Allow custom transformations to be defined for bulk imports. #113
Conversation
end | ||
|
||
should "call the transform proc when the transform option is set" do | ||
transform = stub("lambda") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just use an empty lambda here, to demonstrate the point :)
@karmi requested changes applied. |
Don't forget about the mongoid adapter. |
@ryansch Grr, right, embarrasing! :) @AaronRustad So Ryan is right -- and the correct place to transform the batch is in the |
Makes sense. I'll tackle it in a couple hours. |
No stress, Aaron, will be able to get to it only in the second part of the next week anyways. Thanks for keeping the perseverance! :) |
hehe... the stress is on my side. I need it! ;-) |
OK, so I've made some improvements based on your suggestions. I didn't even think to look at the impact on Mongoid, so thanks to @ryansch for noticing. I've largely pushed the previous code I added up to I've also introduced Thanks! |
Why does the AR version call |
I didn't dig into it, but the current code in master for the Mongoid adapter does that: |
Agreed. Sorry I meant that question for @karmi and should have mentioned him in it. |
@ryansch Might be just some oversight on my side, which slips through because of all the method proxying -- I'll have a look at that, thanks! |
Is there anything I can do to help out on this one? |
Aaron, I need to find time to evaluate the code, and merge it... Is it all 100% done on your side? Would like to get to it this week. |
It's complete as far as what I wanted to add, but you've been pretty good at identifying improvements 😉 . @ryansch brought up the question as to why the Mongoid adapter calls |
Yeah, that's a problem in the Mongoid adapter, let's keep that separate for fixing. I'll look into it soon, promise. |
@AaronRustad Merged into master, thanks! BTW, I don't think we should support this in the Rake tasks? Let's have people write 5 lines of Ruby, when they needed. The Rake task would need some environment variable, |
You could be right. The included Rake task works nicely with the progress bars. There may be an expectation that the rake task works similarly with the new option. |
... yeah, but then again, passing a lambda as a string on the command line, to be evaled? :) I like to think that the gem provides a very comfy infrastructure for people to write their own code, when needed. The progress bar itself is three lines of Ruby, etc etc etc. I don't think we should aim to solve every imaginable requirement -- much the same thing applies to the default callbacks. |
Fair enough. 👍 |
Changes in this PR introduced failures in tests, please check https://travis-ci.org/elastic/elasticsearch-rails/builds |
This allows for the customization of bulk imports. This was driven out of need to include the parent in the index payload, though could extend to any bulk api options.
This functionality doesn't extend to the rake import task. Will address in a separate PR.