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]: [json_path_index] The json index name is field name + "/" rather than field name when the json path is just json field name #40441

Open
1 task done
binbinlv opened this issue Mar 7, 2025 · 1 comment
Assignees
Labels
kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@binbinlv
Copy link
Contributor

binbinlv commented Mar 7, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version: master-20250305-be4d0956-amd64
- Deployment mode(standalone or cluster):both
- MQ type(rocksmq, pulsar or kafka):   all 
- SDK version(e.g. pymilvus v2.0.0rc2):2.6.0rc83
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

The json index name is field name + "/" rather than field name when the json path is just json field name

'my_json/' -> 'my_json'

index_params.add_index(field_name="my_json", index_type="INVERTED", params={"json_cast_type": DataType.INT64, "json_path": "my_json"})
>>> index_list = client.list_indexes(collection_name=collection_name)
>>> index_list
['my_vector', 'my_json/']

Expected Behavior

The json index name is the field name when the json path is just json field name

Steps To Reproduce

from pymilvus import MilvusClient, DataType
import numpy as np
import random
from loguru import logger

client = MilvusClient()
logger.info("connected")


dim=128
nb = 3000
logger.info("creating index params")
schema = client.create_schema(enable_dynamic_field=False)
schema.add_field(field_name="my_id", datatype=DataType.INT64, is_primary=True)
schema.add_field(field_name="my_vector", datatype=DataType.FLOAT_VECTOR, dim=128)
schema.add_field(field_name="my_varchar", datatype=DataType.VARCHAR, max_length=512)
schema.add_field(field_name="my_json", datatype=DataType.JSON)
logger.info("created schema")
logger.info(schema)


collection_name = "customized_setup_102"
logger.info("preparing index params")
index_params = client.prepare_index_params()
index_params.add_index(field_name="my_vector", index_type="AUTOINDEX", metric_type="COSINE")
index_params.add_index(field_name="my_json", index_type="INVERTED", params={"json_cast_type": DataType.INT64, "json_path": "my_json"})
logger.info("prepared index params")
logger.info("creating collection")
client.create_collection(collection_name=collection_name, schema=schema, index_params=index_params)
logger.info("created collection")
index_list = client.list_indexes(collection_name=collection_name)
logger.info(index_list)

Milvus Log

https://grafana-4am.zilliz.cc/explore?orgId=1&panes=%7B%22ovc%22:%7B%22datasource%22:%22vhI6Vw67k%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bcluster%3D%5C%22devops%5C%22,namespace%3D%5C%22chaos-testing%5C%22,pod%3D~%5C%22master-json-index-lvate.%2A%5C%22%7D%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22vhI6Vw67k%22%7D%7D%5D,%22range%22:%7B%22from%22:%22now-1h%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1

Anything else?

No response

@binbinlv binbinlv added kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Mar 7, 2025
@binbinlv binbinlv added this to the 2.6.0 milestone Mar 7, 2025
@binbinlv
Copy link
Contributor Author

binbinlv commented Mar 7, 2025

/assign @sunby

@yanliang567 yanliang567 removed their assignment Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

3 participants