Move ensureIndex to k_storage_manager out of script file