接口定义
drop_index() 接口用于在已有集合上,删除标量字段索引。
def drop_index(self,database_name: str,collection_name: str,field_names: List[str],timeout: Optional[float] = None) -> dict:
注意:
仅支持删除标量索引,不支持删除向量、稀疏向量索引。
如果集合开启了动态schema(即创建集合时配置了 FilterIndexConfig 参数),不支持删除标量索引。
使用实例
import tcvectordbfrom tcvectordb.model.document import Filterfrom tcvectordb.model.enum import FieldType, IndexTypefrom tcvectordb.model.index import Index, FilterIndexres = client.drop_index(database_name='db-test-0314',collection_name='book-vector-0314',field_names=['bookInfo', 'page'],)print(res)
请求参数
参数 | 是否必选 | 参数含义 | 配置方法及要求 |
database_name | 是 | 指定数据库。 | Database 命名要求如下: 只能使用英文字母,数字,下划线_、中划线-,并以英文字母开头。 长度要求:[1,128]。 |
collection_name | 是 | 指定集合名。 | Collection 命名要求如下: 只能使用英文字母,数字,下划线_、中划线-,并以英文字母开头。 长度要求:[1,128]。 |
field_names | 是 | 用于指定删除的标量索引的字段名。 | 以数组形式,列出需删除的字段名。 |