fix error if mongodb is down and externalize elasticsearch config