From d728dd9d3f24b1a0cec7c5215e6506c2ea1d00da Mon Sep 17 00:00:00 2001 From: Marcin Antas Date: Mon, 23 Mar 2026 14:47:43 +0100 Subject: [PATCH] feat: add support for alter schema drop vector index --- weaviate/collections/config/async_.pyi | 1 + weaviate/collections/config/executor.py | 38 +++++++++++++++++++++++++ weaviate/collections/config/sync.pyi | 1 + 3 files changed, 40 insertions(+) diff --git a/weaviate/collections/config/async_.pyi b/weaviate/collections/config/async_.pyi index 015b70dab..91139dd83 100644 --- a/weaviate/collections/config/async_.pyi +++ b/weaviate/collections/config/async_.pyi @@ -90,3 +90,4 @@ class _ConfigCollectionAsync(_ConfigCollectionExecutor[ConnectionAsync]): self, *, vector_config: Union[_VectorConfigCreate, List[_VectorConfigCreate]] ) -> None: ... async def delete_property_index(self, property_name: str, index_name: IndexName) -> bool: ... + async def delete_vector_index(self, vector_name: str) -> bool: ... diff --git a/weaviate/collections/config/executor.py b/weaviate/collections/config/executor.py index c95cba5a3..148174171 100644 --- a/weaviate/collections/config/executor.py +++ b/weaviate/collections/config/executor.py @@ -631,3 +631,41 @@ def resp(res: Response) -> bool: error_msg="Property may not exist", status_codes=_ExpectedStatusCodes(ok_in=[200], error="property exists"), ) + + def delete_vector_index( + self, + vector_name: str, + ) -> executor.Result[bool]: + """Delete a vector index from the collection in Weaviate. + + This is a destructive operation. The index will + need to be regenerated if you wish to use it again. + + Args: + vector_name: The name of the vector whose index to delete. + + Raises: + weaviate.exceptions.WeaviateConnectionError: If the network connection to Weaviate fails. + weaviate.exceptions.UnexpectedStatusCodeError: If Weaviate reports a non-OK status. + weaviate.exceptions.WeaviateInvalidInputError: If the vector does not exist. + """ + _validate_input( + [_ValidateArgument(expected=[str], name="vector_name", value=vector_name)] + ) + + path = ( + f"/schema/{_capitalize_first_letter(self._name)}" + + f"/vectors/{vector_name}" + + "/index" + ) + + def resp(res: Response) -> bool: + return res.status_code == 200 + + return executor.execute( + response_callback=resp, + method=self._connection.delete, + path=path, + error_msg="Vector may not exist", + status_codes=_ExpectedStatusCodes(ok_in=[200], error="vector exists"), + ) diff --git a/weaviate/collections/config/sync.pyi b/weaviate/collections/config/sync.pyi index e54d8c8fc..7bd450819 100644 --- a/weaviate/collections/config/sync.pyi +++ b/weaviate/collections/config/sync.pyi @@ -88,3 +88,4 @@ class _ConfigCollection(_ConfigCollectionExecutor[ConnectionSync]): self, *, vector_config: Union[_VectorConfigCreate, List[_VectorConfigCreate]] ) -> None: ... def delete_property_index(self, property_name: str, index_name: IndexName) -> bool: ... + def delete_vector_index(self, vector_name: str) -> bool: ...