Issue 331 performance es refresh

See #331.

The elasticsearch index is set to no refresh while indexing. When indexing is finished, the index is set to refresh and optimize.
Why the reassignment of `client` here? Seems to be exactly the same as 10 lines above.