How to delete all nodes with specific metadata #16353
Replies: 1 comment 2 replies
-
Hey @notnecessarilylost! I'm here to help you with any bugs, questions, or contributions you have. Let's solve this together! To delete all nodes with a specific def delete(self, ref_doc_id: str, **delete_kwargs: Any) -> None:
"""
Delete nodes using with ref_doc_id.
Args:
ref_doc_id (str): The doc_id of the document to delete.
"""
from qdrant_client.http import models as rest
self._client.delete(
collection_name=self.collection_name,
points_selector=rest.Filter(
must=[
rest.FieldCondition(
key=DOCUMENT_ID_KEY, match=rest.MatchValue(value=ref_doc_id)
)
]
),
) If you prefer to perform this operation asynchronously, you can use the async def adelete(self, ref_doc_id: str, **delete_kwargs: Any) -> None:
"""
Asynchronous method to delete nodes using with ref_doc_id.
Args:
ref_doc_id (str): The doc_id of the document to delete.
"""
await self._aclient.delete(
collection_name=self.collection_name,
points_selector=rest.Filter(
must=[
rest.FieldCondition(
key=DOCUMENT_ID_KEY, match=rest.MatchValue(value=ref_doc_id)
)
]
),
) These methods delete nodes from the Qdrant collection by filtering them based on the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am ingesting Google Docs from a target folder into an index and storing in qdrant running in local embedded mode.
As my user takes files out of the target Google Docs folder I want to delete any nodes that belong to the file that was removed, so they don't show up in future queries.
I store the doc_name and doc_id in metadata for each node. How do I return the nodes with a specific doc_id and then subsequently delete them?
Beta Was this translation helpful? Give feedback.
All reactions