Implemented creation of empty index if needed.

Modified code to check if the index exists and create a new empty index
if it doesn't. This way synchronization works even if auto-index-creation
is turned off and also the ES index is created even in case there are
no packages in NPM registry (yet).

*Note: there was a white-space change, `git show -b 64bf182` gives more accurate diff.*