def to_vespa_partial_document(self, marqo_document: Dict[str, Any], existing_vespa_document: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        """Convert a Marqo document to Vespa partial document format for updates.

        This method transforms a Marqo document into the format required by Vespa for partial document updates.
        It processes each field in the document according to its type and creates the appropriate Vespa field
        representations.

        Args:
            marqo_document: A dictionary containing the Marqo document to be converted. Must contain an '_id' field.
            existing_vespa_document: Optional existing Vespa document to be compared against while creating the update statement

        Returns:
            Dict containing the Vespa partial document format with:
            - 'id': Document ID
            - 'field_types': Field name to type mapping. Later used to create pre-conditions
            - 'fields': Field values. Each field is represented as an update statement, for the actual field, the field type metadata, and the score modifiers if applicable. Example:
                - 'marqo__bool_fields{active}': {"assign": 1}
                - 'marqo__field_type{active}': {"assign": "bool"}
            - 'version_uuid': Original document version_uuid if it exists

        Raises:
            MarqoDocumentParsingError: If '_id' field is missing
            InvalidFieldNameError: If any field name is invalid
        """
        doc_id = self._extract_document_id(marqo_document)
        
        # Convert existing document if provided
        original_doc = None
        if existing_vespa_document:
            original_doc = SemiStructuredVespaDocument.from_vespa_document(
                existing_vespa_document, 
                marqo_index=self.get_marqo_index()
            )

        # Initialize tracking dictionaries
        vespa_fields = {}
        vespa_field_types = {}


        numeric_field_map: Dict[str, Any] = dict() # This map is used to store the numeric fields in the document. It is used to update the numeric fields & score modifiers later
        if original_doc:
            numeric_field_map.update(original_doc.fixed_fields.int_fields)
            numeric_field_map.update(original_doc.fixed_fields.float_fields)

        # Process each field in the document
        for field_name, value in marqo_document.items():
            if field_name == MARQO_DOC_ID:
                continue
                
            validate_field_name(field_name)

            # This method broadly processes the field based on its type and updates the vespa_fields,
            # vespa_field_types, numeric_field_map dictionaries. Numeric fields and numeric field maps
            # are special cases and are processed later.
            self._process_field(field_name=field_name, value=value, fields=vespa_fields, field_types=vespa_field_types,
                                numeric_field_map=numeric_field_map, doc_id=doc_id)

        # This method creates the update statement for updating int fields / int map fields.
        int_fields_changed = self._create_update_statement_for_updating_numeric_and_numeric_map_field(
            int, numeric_field_map, original_doc, vespa_fields, vespa_field_types
        )
        # This method creates the update statement for float numeric fields / float map fields.
        float_fields_changed = self._create_update_statement_for_updating_numeric_and_numeric_map_field(
            float, numeric_field_map, original_doc, vespa_fields, vespa_field_types
        )

        # Handle score modifier updates
        if int_fields_changed or float_fields_changed:
            self._update_score_modifiers(
                original_doc=original_doc,
                numeric_field_map=numeric_field_map,
                vespa_fields=vespa_fields
            )

        # Add version_uuid to the vespa_fields to update the document's version_uuid,
        # only if this is a type of update that requires updating version_uuid (i.e a partial update with map fields)
        if original_doc is not None and original_doc.fixed_fields.version_uuid:
            vespa_fields[common.VESPA_DOC_VERSION_UUID] = {"assign": generate_uuid_str()}

        return {
            "id": doc_id,
            "fields": vespa_fields,
            "field_types": vespa_field_types,
            "version_uuid": original_doc.fixed_fields.version_uuid if original_doc else None # Pass the original document's version uuid, if it exists.
        }
Convert a Marqo document to Vespa partial document format for updates.

        This method transforms a Marqo document into the format required by Vespa for partial document updates.
        It processes each field in the document according to its type and creates the appropriate Vespa field
        representations.

        Args:
            marqo_document: A dictionary containing the Marqo document to be converted. Must contain an '_id' field.
            existing_vespa_document: Optional existing Vespa document to be compared against while creating the update statement

        Returns:
            Dict containing the Vespa partial document format with:
            - 'id': Document ID
            - 'field_types': Field name to type mapping. Later used to create pre-conditions
            - 'fields': Field values. Each field is represented as an update statement, for the actual field, the field type metadata, and the score modifiers if applicable. Example:
                - 'marqo__bool_fields{active}': {"assign": 1}
                - 'marqo__field_type{active}': {"assign": "bool"}
            - 'version_uuid': Original document version_uuid if it exists

        Raises:
            MarqoDocumentParsingError: If '_id' field is missing
            InvalidFieldNameError: If any field name is invalid
        
src/marqo/core/semi_structured_vespa_index/semi_structured_vespa_index.py