def test_concurrent_mixed_add_documents_and_update_documents_requests(self):
        """Test concurrent updates using different API methods on the same document.

        This test verifies that:
        1. Multiple threads can update the same document using different API methods concurrently
        2. One thread uses update_documents to modify specific fields
        3. One thread uses add_documents to replace the entire document
        4. The document remains in a consistent state after all operations
        """
        # First add a document to update
        text_docs = [{
            '_id': '4',
            'tensor_field': 'mixed update test',
            'description': 'This document will be updated by multiple threads using different methods',
            'int_field': 100,
            'float_field': 100.0,
            'tags': ['initial', 'document'],
        }]

        add_docs_response = self.client.index(self.text_index_name).add_documents(
            documents=text_docs,
            mappings={},
            tensor_fields=['tensor_field', 'description']
        )
        self.assertFalse(add_docs_response["errors"])

        def update_documents_thread(index_name):
            """Thread that updates specific fields using update_documents."""
            for i in range(10):
                timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3]
                print(f"[{timestamp}] update_documents thread - iteration {i + 1}/10: Updating int_field and metadata")
                r = self.client.index(index_name).update_documents([{
                    '_id': '4',
                    'int_field': 200 + i,
                    'tensor_field': f'update_documents replaced content {i + 1}',
                    'description': f'This document was updated in iteration {i + 1} inside an update_documents thread',
                }])
                self.assertTrue(r["errors"]) # We can be sure that the response will be error-free due to concurrent updates and the updates sent by the other add documents
                # thread
                timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3]
                print(f"[{timestamp}] update_documents thread - iteration {i + 1} complete. Response: {r}")
                time.sleep(0.5)  # Delay between updates

        def add_documents_thread(index_name):
            """Thread that replaces the entire document using add_documents."""
            for i in range(10):
                timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3]
                print(f"[{timestamp}] add_documents thread - iteration {i + 1}/10: Replacing document")
                r = self.client.index(index_name).add_documents(
                    documents=[{
                        '_id': '4',
                        'tensor_field': f'add_documents replaced content {i + 1}',
                        'description': f'This document was replaced in iteration {i + 1} inside an add_documents thread',
                        'int_field': 300 + i,
                        'float_field': 300.0 + i,
                        'tags': ['replaced', f'iteration-{i + 1}'],
                    }],
                    tensor_fields=['tensor_field', 'description']
                )
                self.assertFalse(r["errors"]) # Assert that there are no errors in the response
                timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3]
                print(f"[{timestamp}] add_documents thread - iteration {i + 1} complete. Response: {r}")
                time.sleep(0.5)  # Delay between updates

        # Create and start threads
        update_thread = threading.Thread(target=update_documents_thread, args=(self.text_index_name,))
        add_thread = threading.Thread(target=add_documents_thread, args=(self.text_index_name,))

        add_thread.start()
        update_thread.start()

        add_thread.join()
        update_thread.join()

        # Verify the final document state
        final_doc = self.client.index(self.text_index_name).get_document(document_id='4')

        # We can't predict exactly which thread's updates will be the final state
        # but we can verify that the document exists and has expected structure
        self.assertEqual(final_doc['_id'], '4')
        self.assertIn('tensor_field', final_doc)
        self.assertIn('description', final_doc)
        self.assertIn('int_field', final_doc)
        self.assertIn('float_field', final_doc)
        self.assertIn('This document was replaced in iteration 10 inside an add_documents thread', final_doc['description'])
        self.assertIn('add_documents replaced content 10', final_doc['tensor_field'])
Test concurrent updates using different API methods on the same document.

        This test verifies that:
        1. Multiple threads can update the same document using different API methods concurrently
        2. One thread uses update_documents to modify specific fields
        3. One thread uses add_documents to replace the entire document
        4. The document remains in a consistent state after all operations
        
tests/api_tests/v1/tests/api_tests/unstructured_index/test_update_documents_unstructured_index.py