milvus-io / milvus

A cloud-native vector database, storage for next generation AI applications
https://milvus.io
Apache License 2.0
31k stars 2.95k forks source link

[Bug]: Create vector index type on scalar field should not be allowed? #25170

Closed yhmo closed 1 year ago

yhmo commented 1 year ago

Is there an existing issue for this?

Environment

- Milvus version: 2.2.10
- Deployment mode(standalone or cluster):
- MQ type(rocksmq, pulsar or kafka):    
- SDK version(e.g. pymilvus v2.0.0rc2):
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

Create vector index type on scalar field is accepted.

    dimension = 128
    field1 = FieldSchema(name="id", dtype=DataType.INT64, is_primary=True)
    field2 = FieldSchema(name="embeddings", dtype=DataType.FLOAT_VECTOR, dim=dimension)
    field3 = FieldSchema(name="title", dtype=DataType.VARCHAR, max_length=256) # max length is 6
    schema = CollectionSchema(fields=[field1, field2, field3])
    collection = Collection(name=collection_name, schema=schema)

    index_params = {"index_type": "HNSW", "metric_type": "L2", "params": {"M": 8, "efConstruction": 200}}
    collection.create_index(field_name="embeddings", index_params=index_params)
    collection.create_index(field_name="title", index_params=index_params)
    print("index created")

    indice = collection.indexes
    for index in indice:
        print(index.to_dict())

After running this script, it shows: {'collection': 'test', 'field': 'embeddings', 'index_name': '_default_idx_101', 'index_param': {'index_type': 'HNSW', 'metric_type': 'L2', 'params': {'M': 8, 'efConstruction': 200}}} {'collection': 'test', 'field': 'title', 'index_name': '_default_idx_102', 'index_param': {'index_type': 'HNSW', 'metric_type': 'L2', 'params': {'M': 8, 'efConstruction': 200}}}

Expected Behavior

Need discussion

Steps To Reproduce

No response

Milvus Log

No response

Anything else?

No response

yanliang567 commented 1 year ago

/assign @czs007 /unassign

smellthemoon commented 1 year ago

/unassign @czs007 /assign

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Reopen the issue with /reopen.