switch indexs from put item to update, also only update the indexes if their values have been changed