Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions weaviate/collections/config/async_.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
38 changes: 38 additions & 0 deletions weaviate/collections/config/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)
1 change: 1 addition & 0 deletions weaviate/collections/config/sync.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Loading