balexand/elasticsearch-rails — pull request #1 by meesterdude (2014-08-30 15:02:12+00:00)
Title: adds Indexing#update_document_attributes

I'm not sure how welcome this is, so I'll punt on adding test coverage till it's clear which direction this branch is going.

My documents are large-ish; large enough that reindexing can be painful, especially when I need to reindex multiple documents. I overrode `as_indexed_json` and it does a lot of computing in itself, such as fetching across relations and such.

The problem I ran into is when I have just one attribute (in my case, a cache timestamp) that I want to update, there seemed no easy way to change it alone. I see `update-document` but that tries to be clever with dirty attributes (and didn't seem to work for me in my testing) and there is no way to force it's behavior otherwise. Even still, it calls `as_indexed_json` which is computationally expensive for me to do.

So, I wanted a way to do something like AR `update_attributes` but with ES, and without having to ever call `as_indexed_json`. So, this is what I came up with.