elasticsearch/elasticsearch-rails — pull request #262 by rcillo (2014-10-06 19:15:57+00:00)
Title: Bulk save

This is a draft implementation regarding #199 introducing `bulk_save` method to the `Elasticsearch::Persistence::Repository` module.

But, what do you expect from the API?

For example, what would the desired result? A list of errors? The number of errors? The direct result from `client.bulk` call? A boolean?

`Elasticsearch::Model::Importing#import` https://github.com/elasticsearch/elasticsearch-rails/blob/master/elasticsearch-model/lib/elasticsearch/model/importing.rb#L102 method accepts some options, like `return: "count"` that specifies if the desired response is a list of errors or a count. Would it make sense in this context?

Currently, there is a `save` method https://github.com/elasticsearch/elasticsearch-rails/blob/master/elasticsearch-persistence/lib/elasticsearch/persistence/repository/store.rb#L17 which accepts a single document. Some could expect that method to accept a collection of documents. But that could lead to a confuse API, since the return type is going to be based on the input type.

Did not added tests yet, since we need to properly define the API.

Waiting to hear from you :smile: