Fixed indexing bug. Refactoring of Elastic stuff
Merged in master