Repository: langchain
Issue: Milvus upsert doesnt retain previous id/pk
Labels: Ɑ: vector store

### Checked other resources

- [X] I added a very descriptive title to this issue.
- [X] I searched the LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.
- [X] I am sure that this is a bug in LangChain rather than my code.
- [x] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

### Example Code
```python
import os
from langchain_openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings(model="text-embedding-3-large")
from langchain_milvus import Milvus

URI = "http://localhost:19530"
 
vector_store = Milvus(
    embedding_function=embeddings,
    connection_args={"uri": URI},
    collection_name="langchain_example",
    auto_id = True,
    drop_old = True
)
 

from langchain_core.documents import Document
 
document_1 = Document(
    page_content="I had chocalate chip pancakes and scrambled eggs for breakfast this morning.",
    metadata={"source": "tweet"},
)
 
document_2 = Document(
    page_content="The weather forecast for tomorrow is cloudy and overcast, with a high of 62 degrees.",
    metadata={"source": "news"},
)
 
document_3 = Document(
    page_content="Building an exciting new project with LangChain - come check it out!",
    metadata={"source": "tweet"},
)
 
document_4 = Document(
    page_content="Robbers broke into the city bank and stole $1 million in cash.",
    metadata={"source": "news"},
)
 
document_5 = Document(
    page_content="Wow! That was an amazing movie. I can't wait to see it again.",
    metadata={"source": "tweet"},
)
 
document_6 = Document(
    page_content="Is the new iPhone worth the price? Read this review to find out.",
    metadata={"source": "website"},
)
 
document_7 = Document(
    page_content="The top 10 soccer players in the world right now.",
    metadata={"source": "website"},
)
 
document_8 = Document(
    page_content="LangGraph is the best framework for building stateful, agentic applications!",
    metadata={"source": "tweet"},
)
 
document_9 = Document(
    page_content="The stock market is down 500 points today due to fears of a recession.",
    metadata={"source": "news"},
)
 
document_10 = Document(
    page_content="I have a bad feeling I am going to get deleted :(",
    metadata={"source": "tweet"},
)
 
 
documents = [
    document_1,
    document_2,
    document_3,
    document_4,
    document_5,
    document_6,
    document_7,
    document_8,
    document_9,
    document_10,
]

vector_store.add_documents(documents=documents)
 
results = vector_store.similarity_search(
    "LangChain provides abstractions to make working with LLMs easy",
    k=2,
   
)

id = results[0].metadata['pk']
vector_store.upsert(ids=[id],documents=[Document(
    page_content="Building an exciting new project with LangChain - come check it out!",
    metadata={"source": "samsung"},
)])
print("updated list")
 
results = vector_store.similarity_search(
    "LangChain provides abstractions to make working with LLMs easy",
    k=3,
   
)
print("modified: ")
pprint(results)
```

### Error Message and Stack Trace (if applicable)

_No response_

### Description

I'm trying to use langchain milvus to update the metadata in my chunks. Currently im able to replace the metadata and content, but it generates a new pk/id when doing so. Please add another function argument that lets us use the same id as the original chunk. (I know its stupid but my boss wants this, dont ask me)
so something like this: 
```python
def upsert(  # type: ignore
        self,
        ids: Optional[List[str]] = None,
        documents: List[Document] | None = None,
        use_original_ids : Optional[Bool], # something like this
        **kwargs: Any,
    ) -> List[str] | None:
        """Update/Insert documents to the vectorstore.

        Args:
            ids: IDs to update - Let's call get_pks to get ids with expression \n
            documents (List[Document]): Documents to add to the vectorstore.

        Returns:
            List[str]: IDs of the added texts.
        """

        if documents is None or len(documents) == 0:
            logger.debug("No documents to upsert.")
            return None

        if ids is not None and len(ids):
            try:
                self.delete(ids=ids)
            except MilvusException:
                pass
        try:
           if(use_original_ids): # something like this
                return self.add_documents(documents=documents, ids=ids, **kwargs)
           else:
               return self.add_documents(documents=documents, **kwargs)
        except MilvusException as exc:
            logger.error(
                "Failed to upsert entities: %s error: %s", self.collection_name, exc
            )
            raise exc
```

### System Info

System Information
------------------
> OS:  Linux
> OS Version:  #21~22.04.1-Ubuntu SMP Thu Nov  7 17:33:30 UTC 2024
> Python Version:  3.10.12 (main, Nov  6 2024, 20:22:13) [GCC 11.4.0]
 
Package Information
-------------------
> langchain_core: 0.3.15
> langchain: 0.3.7
> langchain_community: 0.2.3
> langsmith: 0.1.129
> langchain_milvus: 0.1.6
> langchain_openai: 0.2.1
> langchain_text_splitters: 0.3.2
 
Optional packages not installed
-------------------------------
> langgraph
> langserve
 
Other Dependencies
------------------
> aiohttp: 3.9.5
> aiosqlite: 0.20.0
> aleph-alpha-client: Installed. No version info available.
> anthropic: Installed. No version info available.
> arxiv: Installed. No version info available.
> assemblyai: Installed. No version info available.
> async-timeout: 4.0.3
> atlassian-python-api: Installed. No version info available.
> azure-ai-documentintelligence: Installed. No version info available.
> azure-identity: Installed. No version info available.
> azure-search-documents: Installed. No version info available.
> beautifulsoup4: 4.12.3
> bibtexparser: Installed. No version info available.
> cassio: Installed. No version info available.
> chardet: 4.0.0
> cloudpathlib: Installed. No version info available.
> cloudpickle: 3.0.0
> cohere: Installed. No version info available.
> databricks-vectorsearch: Installed. No version info available.
> dataclasses-json: 0.6.6
> datasets: Installed. No version info available.
> dgml-utils: Installed. No version info available.
> elasticsearch: 8.14.0
> esprima: Installed. No version info available.
> faiss-cpu: Installed. No version info available.
> feedparser: Installed. No version info available.
> fireworks-ai: Installed. No version info available.
> friendli-client: Installed. No version info available.
> geopandas: Installed. No version info available.
> gitpython: Installed. No version info available.
> google-cloud-documentai: Installed. No version info available.
> gql: Installed. No version info available.
> gradientai: Installed. No version info available.
> hdbcli: Installed. No version info available.
> hologres-vector: Installed. No version info available.
> html2text: Installed. No version info available.
> httpx: 0.27.0
> httpx-sse: Installed. No version info available.
> javelin-sdk: Installed. No version info available.
> jinja2: 3.1.4
> jq: Installed. No version info available.
> jsonpatch: 1.33
> jsonschema: 4.21.1
> lxml: 5.2.2
> markdownify: Installed. No version info available.
> motor: Installed. No version info available.
> msal: Installed. No version info available.
> mwparserfromhell: Installed. No version info available.
> mwxml: Installed. No version info available.
> newspaper3k: Installed. No version info available.
> numexpr: Installed. No version info available.
> numpy: 2.0.0
> nvidia-riva-client: Installed. No version info available.
> oci: Installed. No version info available.
> openai: 1.52.2
> openapi-pydantic: Installed. No version info available.
> oracle-ads: Installed. No version info available.
> oracledb: Installed. No version info available.
> orjson: 3.10.3
> packaging: 23.2
> pandas: 2.2.2
> pdfminer-six: 20231228
> pgvector: Installed. No version info available.
> praw: Installed. No version info available.
> premai: Installed. No version info available.
> psychicapi: Installed. No version info available.
> py-trello: Installed. No version info available.
> pydantic: 2.9.2
> pyjwt: 2.3.0
> pymilvus: 2.4.3
> pymupdf: Installed. No version info available.
> pypdf: 4.3.0
> pypdfium2: 4.30.0
> pyspark: Installed. No version info available.
> PyYAML: 6.0.1
> rank-bm25: Installed. No version info available.
> rapidfuzz: 3.9.4
> rapidocr-onnxruntime: Installed. No version info available.
> rdflib: Installed. No version info available.
> requests: 2.32.3
> requests-toolbelt: 1.0.0
> rspace_client: Installed. No version info available.
> scikit-learn: 1.5.0
> simsimd: Installed. No version info available.
> SQLAlchemy: 2.0.30
> sqlite-vss: Installed. No version info available.
> streamlit: Installed. No version info available.
> sympy: 1.13.0
> telethon: Installed. No version info available.
> tenacity: 8.3.0
> tidb-vector: Installed. No version info available.
> tiktoken: 0.7.0
> timescale-vector: Installed. No version info available.
> tqdm: 4.66.4
> tree-sitter: Installed. No version info available.
> tree-sitter-languages: Installed. No version info available.
> typer: 0.12.3
> typing-extensions: 4.12.1
> upstash-redis: Installed. No version info available.
> vdms: Installed. No version info available.
> xata: Installed. No version info available.
> xmltodict: 0.13.0