Skip to content

[Bug]: [Struct Array]Create index failed with error array of vector index does not support metric type: MAX_SIM_IP (same for MAX_SIM_COSINE ) #44504

@zhuwenxing

Description

@zhuwenxing

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version:2.6
- Deployment mode(standalone or cluster):
- MQ type(rocksmq, pulsar or kafka):    
- SDK version(e.g. pymilvus v2.0.0rc2): git+https://github.com/SpadeA-Tang/pymilvus.git@struct-sdk
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

only metric type MAX_SIM can work

self = <test_milvus_client_struct_array.TestMilvusClientStructArrayIndex object at 0x12c0a4100>

    @pytest.mark.tags(CaseLabel.L0)
    def test_create_emb_list_hnsw_index_ip(self):
        """
        target: test create EMB_LIST_HNSW index with MAX_SIM_IP metric
        method: create index on vector field in struct array with IP metric
        expected: index creation successful
        """
        client = self._client()
    
        # Create collection with data
        self.create_collection_with_data(client, self.collection_name)
    
        # Create index parameters
        index_params = client.prepare_index_params()
        index_params.add_index(
            field_name="normal_vector",
            index_type="IVF_FLAT",
            metric_type="L2",
            params={"nlist": 128}
        )
    
        # Create EMB_LIST_HNSW index with IP metric
        index_params.add_index(
            field_name="vector_field",
            index_name="struct_vector_index_ip",
            index_type="EMB_LIST_HNSW",
            metric_type="MAX_SIM_IP",
            params=INDEX_PARAMS
        )
    
>       res, check = self.create_index(client, self.collection_name, index_params)

milvus_client/test_milvus_client_struct_array.py:512: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
utils/wrapper.py:33: in inner_wrapper
    res, result = func(*args, **kwargs)
base/client_v2_base.py:551: in create_index
    **kwargs).run()
check/func_check.py:47: in run
    result = self.assert_succ(self.succ, True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <check.func_check.ResponseChecker object at 0x12c0ec580>, actual = False, expect = True

    def assert_succ(self, actual, expect):
>       assert actual is expect, f"Response of API {self.func_name} expect {expect}, but got {actual}"
E       AssertionError: Response of API create_index expect True, but got False

check/func_check.py:137: AssertionError
------------------------------------------------------------------------------------------ Captured log setup ------------------------------------------------------------------------------------------
[2025-09-22 17:38:00 - INFO - ci_test]: ################################################################################ (conftest.py:264)
[2025-09-22 17:38:00 - INFO - ci_test]: [initialize_milvus] Log cleaned up, start testing... (conftest.py:265)
[2025-09-22 17:38:00 - INFO - ci_test]: [setup_class] Start setup class... (client_base.py:40)
[2025-09-22 17:38:00 - INFO - ci_test]: *********************************** setup *********************************** (client_base.py:46)
[2025-09-22 17:38:00 - INFO - ci_test]: pymilvus version: 0.1.0rc2052 (client_base.py:47)
[2025-09-22 17:38:00 - INFO - ci_test]: [setup_method] Start setup test case test_create_emb_list_hnsw_index_ip. (client_base.py:48)
------------------------------------------------------------------------------------------ Captured log call -------------------------------------------------------------------------------------------
[2025-09-22 17:38:00 - DEBUG - ci_test]: (api_request)  : [MilvusClient] args: ['http://10.104.15.237:19530', '', '', '', 'root:Milvus', None], kwargs: {} (api_request.py:52)
[2025-09-22 17:38:00 - DEBUG - ci_test]: (api_response) : <pymilvus.milvus_client.milvus_client.MilvusClient object at 0x12c0a4520>  (api_request.py:27)
[2025-09-22 17:38:00 - INFO - ci_test]: server version: 2.6.2 (client_v2_base.py:44)
[2025-09-22 17:38:00 - DEBUG - ci_test]: (api_request)  : [MilvusClient.create_collection] args: ['struct_array_index_MLVmEz3v', None, 'id', 'int', 'vector', 'COSINE', False, 120, {'auto_id': False, 'description': '', 'fields': [{'name': 'id', 'description': '', 'type': <DataType.INT64: 5>, 'is_primary': True, 'auto_id': False}, {'name': 'normal_vector', 'description': '', 'type': <DataType.FLO......, kwargs: {'consistency_level': 'Strong'} (api_request.py:52)
[2025-09-22 17:38:01 - DEBUG - ci_test]: (api_response) : None  (api_request.py:27)
[2025-09-22 17:38:01 - DEBUG - ci_test]: (api_request)  : [MilvusClient.insert] args: ['struct_array_index_MLVmEz3v', [{'id': 0, 'normal_vector': [0.64641161348147, 0.38712339458425005, 0.7248727658067626, 0.2866626416019905, 0.3953532304900532, 0.4047762986456769, 0.15012100168503095, 0.4294529121459454, 0.8683293692253191, 0.36463975461182496, 0.7120631948168967, 0.0333348037092082......, kwargs: {'timeout': 120} (api_request.py:52)
[2025-09-22 17:38:01 - DEBUG - ci_test]: (api_response) : {'insert_count': 100, 'ids': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, ......  (api_request.py:27)
[2025-09-22 17:38:01 - DEBUG - ci_test]: (api_request)  : [MilvusClient.create_index] args: ['struct_array_index_MLVmEz3v', [{'field_name': 'normal_vector', 'index_type': 'IVF_FLAT', 'index_name': '', 'nlist': 128, 'metric_type': 'L2'}, {'field_name': 'vector_field', 'index_type': 'EMB_LIST_HNSW', 'index_name': 'struct_vector_index_ip', 'M': 16, 'efConstruction': 200, 'metric_type': 'MAX_S......, kwargs: {'timeout': 120} (api_request.py:52)
[2025-09-22 17:38:01 - ERROR - ci_test]: Traceback (most recent call last):
  File "/Users/zilliz/workspace/milvus-struct-array-test/tests/python_client/utils/api_request.py", line 22, in inner_wrapper
    res = func(*args, **_kwargs)
  File "/Users/zilliz/workspace/milvus-struct-array-test/tests/python_client/utils/api_request.py", line 53, in api_request
    return func(*arg, **kwargs)
  File "/Users/zilliz/workspace/milvus-struct-array-test/tests/python_client/.venv/lib/python3.10/site-packages/pymilvus/milvus_client/milvus_client.py", line 163, in create_index
    self._create_index(collection_name, index_param, timeout=timeout, **kwargs)
  File "/Users/zilliz/workspace/milvus-struct-array-test/tests/python_client/.venv/lib/python3.10/site-packages/pymilvus/milvus_client/milvus_client.py", line 185, in _create_index
    raise ex from ex
  File "/Users/zilliz/workspace/milvus-struct-array-test/tests/python_client/.venv/lib/python3.10/site-packages/pymilvus/milvus_client/milvus_client.py", line 174, in _create_index
    conn.create_index(
  File "/Users/zilliz/workspace/milvus-struct-array-test/tests/python_client/.venv/lib/python3.10/site-packages/pymilvus/decorators.py", line 141, in handler
    raise e from e
  File "/Users/zilliz/workspace/milvus-struct-array-test/tests/python_client/.venv/lib/python3.10/site-packages/pymilvus/decorators.py", line 137, in handler
    return func(*args, **kwargs)
  File "/Users/zilliz/workspace/milvus-struct-array-test/tests/python_client/.venv/lib/python3.10/site-packages/pymilvus/decorators.py", line 173, in handler
    return func(self, *args, **kwargs)
  File "/Users/zilliz/workspace/milvus-struct-array-test/tests/python_client/.venv/lib/python3.10/site-packages/pymilvus/decorators.py", line 116, in handler
    raise e from e
  File "/Users/zilliz/workspace/milvus-struct-array-test/tests/python_client/.venv/lib/python3.10/site-packages/pymilvus/decorators.py", line 86, in handler
    return func(*args, **kwargs)
  File "/Users/zilliz/workspace/milvus-struct-array-test/tests/python_client/.venv/lib/python3.10/site-packages/pymilvus/client/grpc_handler.py", line 1143, in create_index
    check_status(status)
  File "/Users/zilliz/workspace/milvus-struct-array-test/tests/python_client/.venv/lib/python3.10/site-packages/pymilvus/client/utils.py", line 65, in check_status
    raise MilvusException(status.code, status.reason, status.error_code)
pymilvus.exceptions.MilvusException: <MilvusException: (code=1100, message=array of vector index does not support metric type: MAX_SIM_IP: invalid parameter[expected=valid index params][actual=invalid index params])>
 (api_request.py:35)
[2025-09-22 17:38:01 - ERROR - ci_test]: (api_response) : <MilvusException: (code=1100, message=array of vector index does not support metric type: MAX_SIM_IP: invalid parameter[expected=valid index params][actual=invalid index params])> (api_request.py:36)

Expected Behavior

No response

Steps To Reproduce

Milvus Log

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions