Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: create index on json field is not supported: expected=supported field, actual=create index on 104 field: invalid parameter #2407

Open
1 task done
Joyce920hope opened this issue Dec 4, 2024 · 0 comments
Labels
kind/bug Something isn't working

Comments

@Joyce920hope
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I'm following this example https://github.com/milvus-io/pymilvus/blob/master/examples/sparse.py to store sparse embedding in Milvus server.

I got this error when I created an index on collection:
client.create_collection('my_sparse_collection', schema=schema,
index_params=index_params, timeout=5, consistency_level="Strong")

error:
RPC error: [create_index], <MilvusException: (code=1100, message=create index on json field is not supported: expected=supported field, actual=create index on 104 field: invalid parameter)>, <Time:{'RPC start': '2024-12-04 11:47:50.713235', 'RPC error': '2024-12-04 11:47:50.793430'}>
Failed to create an index on collection: my_sparse_collection

Expected Behavior

The index can be created on sparse vector field.

Steps/Code To Reproduce behavior

uri = f"http://{MILVUS_HOST}:{MILVUS_PORT}"
    
client = MilvusClient(
    uri=uri,
    user = MILVUS_USER,
    password = MILVUS_PASSWORD,
    db_name = "default",
)


fields = [
    FieldSchema(name="pk", dtype=DataType.VARCHAR,
                is_primary=True, auto_id=True, max_length=100),
    FieldSchema(name="random", dtype=DataType.DOUBLE),
    FieldSchema(name="sparse_vector", dtype=DataType.SPARSE_FLOAT_VECTOR),
]
schema = CollectionSchema(
    fields, "demo for using sparse float vector with milvus client")

index_params = client.prepare_index_params()
index_params.add_index(field_name="sparse_vector", index_name="sparse_inverted_index",
                       index_type="SPARSE_INVERTED_INDEX", metric_type="IP", params={"drop_ratio_build": 0.2})
client.create_collection('my_sparse_collection', schema=schema,
                                index_params=index_params, timeout=5, consistency_level="Strong")

Environment details

Milvus version: 2.2.8
pymilvus version: 2.5.0

Anything else?

No response

@Joyce920hope Joyce920hope added the kind/bug Something isn't working label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant