def test_to_vespa_document_fieldNotInIndex_fails(self):
        """
        Test that an error is raised when a field is not in the index.
        """
        with self.assertRaises(core_exceptions.InvalidFieldNameError):
            self.vespa_index.to_vespa_document(
                {
                    '_id': 'my_id',
                    'title': 'my title',
                    'nonexistent field': 'fail'
                }
            )

        Test that an error is raised when a field is not in the index.
        
tests/integ_tests/core/structured_vespa_index/test_structured_vespa_index.py