add index before upsert