Skip to content

如何快速查询milvus中int类型数据的最大最小值 #41701

Discussion options

You must be logged in to vote

也许有一个方法可以一试。
假设我有一张表,有个字段叫"flag",int型,里面的值是未知的,值有可能很大有可能很小。
我给这个flag字段建了个索引。

schema = MilvusClient.create_schema()
schema.add_field(field_name="id", datatype=DataType.INT64, is_primary=True, auto_id=True)
schema.add_field(field_name="vector", datatype=DataType.FLOAT_VECTOR, dim=dim)
schema.add_field(field_name="flag", datatype=DataType.INT64)

index_params = client.prepare_index_params()
index_params.add_index(
    field_name="vector",
    index_type="FLAT",
    metric_type="L2",
)
index_params.add_index(
    field_name="flag",
    index_type="STL_SORT",
)

client.create_collection(
    collection_name=collection_name,
    schema=schema,
    index_params=index_params,
)
print(collection_n…

Replies: 2 comments 15 replies

Comment options

You must be logged in to vote
7 replies
@IeohMingChan
Comment options

@xiaofan-luan
Comment options

@IeohMingChan
Comment options

@xiaofan-luan
Comment options

@IeohMingChan
Comment options

Comment options

You must be logged in to vote
8 replies
@yhmo
Comment options

yhmo May 8, 2025
Collaborator

@phstan
Comment options

@xiaofan-luan
Comment options

@phstan
Comment options

@yhmo
Comment options

yhmo May 9, 2025
Collaborator

Answer selected by IeohMingChan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants