-
Notifications
You must be signed in to change notification settings - Fork 135
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
Support bulk operations in the native client #24
Comments
Desired APIWe should try hard to support the exact API our REST client has. It has two key benefits:
The REST API already has a decent way of representing bulk requests in JSON, which maps ideally to Clojure Implementation DetailsThis is for @dsabanin, who's expressed interest in implementing this feature. Every operation in the native client has a few functions beyond what is exposed in the public API. Namely, Specifically for this feature, we need a function that will delegate to Client#bulk. Then there are conversion functions to bulk request and from bulk response in clojurewerkz.elastisch.native.conversion. Finally, there is a function (or several) that will be our public API for bulk requests. It glues everything together. Since The public API should be in Because conversion functions are annoying to develop, I highly recommend doing it all in the REPL first, then ElasticSearch VersionElastisch 1.1's native client targets ElasticSearch 0.90.0-beta1. Because binary format used by the client and |
Thanks for a really comprehensive description of the task. I'm going to give it a try this weekend. |
It looks like I won't get a chance to work on it. Our initial requirements changed and we moved in another direction, ended up not using native bulk API. Sorry about wasting your time on the instruction, although I'm sure some future implementor will find them very useful. |
That's ok. I'd be happy to hear what you ended up doing as an alternative (if it involves Elastisch at all). |
The problem I was trying to solve is initial indexing of a big amount of data from the DB. This was a one time job so I decided to go with a C program fetching data from DB and generating a limited subset of JSON and then importing it to ES with curl through bulk API. We are still using Elastisch for real-time indexing -- it's a great piece of software. Too bad I couldn't contribute back. |
Just wanted to let you know I started working on this, and I am making some good progress :) Will try to have something ready by the end of this weekend. |
@mitchelkuijpers sounds good, thank you. |
I have a first version working i currently give this structure back after a bulk operation:
I case of failure the failed? property will be true and a failure-message property will be added. I notice the rest api gives properties back like :_index and :_type. Do you think I should add those @michaelklishin ? |
@mitchelkuijpers yes, as aliases for |
@michaelklishin Added, and also The only thing that I think we should not implement is: Another idea could be to reuse the |
After thinking about it some more I am leaning towards the option of reusing the bulk-index and bulk-delete functions from |
That's fine. I find those functions a bit odd in the REST API. 100% compatibility is not the goal. If we can keep it at 95%, that's already huge for our users. |
@mitchelkuijpers so, native would delegate to REST? This should be made very clear in the docs because the two use different ports and some installations may be locked down to only one protocol at the firewall. |
@michaelklishin No Native would only re-use these functions from rest:
And then if you call bulk or the other two bulk functions (those are easy to implement this way) this will be transformed to either and IndexRequest or an DeleteRequest and we can simply call the native api :) |
@mitchelkuijpers ah, perfect. Feel free to extract them into a separate internal namespace, e.g. |
@mitchelkuijpers any other way I can help you? I'd be very excited to see this feature added :) |
I'll try to have a pull request ready tomorrow, had a busy week ^^ |
A first stab at Support bulk operations in the native client #24
Contributed by @mitchelkuijpers in #144. |
We need to support bulk operations in the native client with the same Clojure API we
have in the REST one.
The text was updated successfully, but these errors were encountered: