def test_update_a_document_without_id(self):
        """Test attempting to update a document without providing an '_id' field."""
        updated_doc = {
            "text_field": "updated text field"
        }
        # Attempt to update a document without specifying an '_id'
        r = self.client.index(self.update_doc_index_name).update_documents(documents=[updated_doc])

        # Check for errors indicating the missing '_id' field
        self.assertEqual(True, r["errors"])
        self.assertIn("'_id' is a required field but it does not exist", r["items"][0]["error"])
        self.assertEqual(400, r["items"][0]["status"])
        # Verify no documents have been inadvertently added or modified in the index
        self.assertEqual(0, self.client.index(self.update_doc_index_name).get_stats()["numberOfDocuments"])
Test attempting to update a document without providing an '_id' field.
tests/api_tests/v1/tests/api_tests/structured_index/test_partial_update_document.py