@@ -666,3 +666,41 @@ def resp(res: Response) -> bool:
666666 error_msg = "Property may not exist" ,
667667 status_codes = _ExpectedStatusCodes (ok_in = [200 ], error = "property exists" ),
668668 )
669+
670+ def delete_vector_index (
671+ self ,
672+ vector_name : str ,
673+ ) -> executor .Result [bool ]:
674+ """Delete a vector index from the collection in Weaviate.
675+
676+ This is a destructive operation. The index will
677+ need to be regenerated if you wish to use it again.
678+
679+ Args:
680+ vector_name: The name of the vector whose index to delete.
681+
682+ Raises:
683+ weaviate.exceptions.WeaviateConnectionError: If the network connection to Weaviate fails.
684+ weaviate.exceptions.UnexpectedStatusCodeError: If Weaviate reports a non-OK status.
685+ weaviate.exceptions.WeaviateInvalidInputError: If the vector does not exist.
686+ """
687+ _validate_input (
688+ [_ValidateArgument (expected = [str ], name = "vector_name" , value = vector_name )]
689+ )
690+
691+ path = (
692+ f"/schema/{ _capitalize_first_letter (self ._name )} "
693+ + f"/vectors/{ vector_name } "
694+ + "/index"
695+ )
696+
697+ def resp (res : Response ) -> bool :
698+ return res .status_code == 200
699+
700+ return executor .execute (
701+ response_callback = resp ,
702+ method = self ._connection .delete ,
703+ path = path ,
704+ error_msg = "Vector may not exist" ,
705+ status_codes = _ExpectedStatusCodes (ok_in = [200 ], error = "vector exists" ),
706+ )
0 commit comments