def test_partial_update_new_map_field(self):
        """
        Test the following scenario:
        1. Add a map with a partial update,
        2. Update it with another partial update, remove the existing keys
        3. Final state of the doc should only contain the Map sent in #2
        """
        text_docs = [
            {
                '_id': '4',
                'text': 'This is a test document',
                'rank': 100,
            }
        ]
        add_docs_response = self.client.index(self.text_index_name).add_documents(
            documents=text_docs,
            mappings={},
            tensor_fields=['text']
        )

        get_doc = self.client.index(self.text_index_name).get_document('4')
        self.assertEqual(get_doc['rank'], text_docs[0]['rank'])

        update_docs_response = self.client.index(self.text_index_name).update_documents(
            [ {
                '_id': '4',
                'metadata': {'key1': 100.5}
            }]
        )
        self.assertFalse(update_docs_response['errors'])

        update_docs_response_2 = self.client.index(self.text_index_name).update_documents(
            [{
                '_id': '4',
                'metadata': {'key2': 100.5},
            }]
        )

        self.assertFalse(update_docs_response_2['errors'])

        get_docs_result = self.client.index(index_name=self.text_index_name).get_document(document_id='4')
        self.assertIsNone(get_docs_result.get('metadata.key1'))
        self.assertEqual(get_docs_result['metadata.key2'], 100.5)

        base_search_result = self.client.index(index_name=self.text_index_name).search("test document")
        base_score = base_search_result["hits"][0]["_score"]

        search_result_with_non_existent_score_modifier = self.client.index(index_name = self.text_index_name).search("test document", score_modifiers={
            "add_to_score": [{"field_name": "metadata.key1", "weight": 1}]
        })

        score_with_non_existent_score_modifier = search_result_with_non_existent_score_modifier["hits"][0]["_score"]
        # Since the score modifier should not exist after the map has been completely replaced, the scores should be the same
        self.assertAlmostEqual(score_with_non_existent_score_modifier, base_score, 5)

        search_with_existing_score_modifier = self.client.index(index_name = self.text_index_name).search("test document", score_modifiers={
            "add_to_score": [{"field_name": "metadata.key2", "weight": 1}]
        })

        score_with_existing_score_modifier = search_with_existing_score_modifier["hits"][0]["_score"]
        self.assertAlmostEqual(score_with_existing_score_modifier, base_score + 1*100.5, 5)

        Test the following scenario:
        1. Add a map with a partial update,
        2. Update it with another partial update, remove the existing keys
        3. Final state of the doc should only contain the Map sent in #2
        
tests/api_tests/v1/tests/api_tests/unstructured_index/test_update_documents_unstructured_index.py