Improve Elasticsearch error handling in try_to_index

* Iterate the correct number of times, instead of half the number of specified times
* If indexing fails at the end, reraise the exception instead of silently swallowing it
Good point. That would have made this bug obvious in the first case, for that matter.