Fixed the following bugs:

1. All docs need to be indexed each search.
2. ES does not close properly.