async def reset_history(db, index_id: str):
    """
    Set the index.id and index.version fields with the given index id to 'unbuilt'.

    :param db: The virtool database
    :param index_id: The ID of the index which failed to build

    """
    query = {"_id": {"$in": await db.history.distinct("_id", {"index.id": index_id})}}

    return await db.history.update_many(
        query, {"$set": {"index": {"id": "unbuilt", "version": "unbuilt"}}}
    )