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 #38221

Open
1 task done
Joyce920hope opened this issue Dec 4, 2024 · 4 comments
Assignees
Labels
help wanted Extra attention is needed stale indicates no udpates for 30 days

Comments

@Joyce920hope
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version: 2.2.8 
- SDK version(e.g. pymilvus v2.0.0rc2): pymilvus version: 2.5.0

Current Behavior

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 To Reproduce

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")

Milvus Log

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_collection11111

MilvusException Traceback (most recent call last)
[... skipping hidden 1 frame]

Cell In[19], line 4
2 index_params.add_index(field_name="sparse_vector", index_name="sparse_inverted_index",
3 index_type="SPARSE_INVERTED_INDEX", metric_type="IP", params={"drop_ratio_build": 0.2})
----> 4 client.create_collection('my_sparse_collection11111', schema=schema,
5 index_params=index_params, timeout=5, consistency_level="Strong")

Anything else?

No response

@Joyce920hope Joyce920hope added kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Dec 4, 2024
@yanliang567
Copy link
Contributor

@Joyce920hope as the error msg said, JSON was supported since v2.2.9 and Sparse vector was supported since 2.4.x. So please use the latest milvus release v2.4.17 or v2.5.0-beta

/assign @Joyce920hope
/unassign

@yanliang567 yanliang567 added help wanted Extra attention is needed and removed kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Dec 5, 2024
@xiaofan-luan
Copy link
Collaborator

@yanliang567
I think user is asking for json index supprot.
@sunby is working on that and hopefully this can be part of 2.5.1

@Joyce920hope
Copy link
Author

@Joyce920hope as the error msg said, JSON was supported since v2.2.9 and Sparse vector was supported since 2.4.x. So please use the latest milvus release v2.4.17 or v2.5.0-beta

/assign @Joyce920hope /unassign

@yanliang567 Thank you for clarifying!

Copy link

stale bot commented Jan 5, 2025

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 stale bot added the stale indicates no udpates for 30 days label Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed stale indicates no udpates for 30 days
Projects
None yet
Development

No branches or pull requests

3 participants