Skip to content

[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

Closed
@binbinlv

Description

@binbinlv

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

Metadata

Metadata

Assignees

Labels

kind/bugIssues or changes related a bugtriage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions