Update ensure_index.

The ensure_index method is checking for all indexes - which does not necessary work
in all cases.