Skip to content

[Bug]: AsyncMilvusClient does not support struct array #3059

@woestler

Description

@woestler

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I created the collection according to the steps in the document.

from pymilvus import MilvusClient, DataType

schema = MilvusClient.create_schema()

schema.add_field(field_name="id", datatype=DataType.INT64, is_primary=True, auto_id=True)

schema.add_field(field_name="title", datatype=DataType.VARCHAR, max_length=512)
schema.add_field(field_name="author", datatype=DataType.VARCHAR, max_length=512)
schema.add_field(field_name="year_of_publication", datatype=DataType.INT64)

schema.add_field(field_name="title_vector", datatype=DataType.FLOAT_VECTOR, dim=5)

struct_schema = MilvusClient.create_struct_field_schema()

struct_schema.add_field("text", DataType.VARCHAR, max_length=65535)
struct_schema.add_field("chapter", DataType.VARCHAR, max_length=512)

struct_schema.add_field("text_vector", DataType.FLOAT_VECTOR, mmap_enabled=True, dim=5)

schema.add_field("chunks", datatype=DataType.ARRAY, element_type=DataType.STRUCT, 
                    struct_schema=struct_schema, max_capacity=1000)

# The index was correctly created in the subsequent code.

An error occurred while performing the search using AsyncMilvusClient. The search code is as follows:

# from pymilvus import EmbeddingList
from pymilvus.client.embedding_list import EmbeddingList
import asyncio

async def main():
    # each query embedding list triggers a single search
    embeddingList1 = EmbeddingList()
    embeddingList1.add([0.2, 0.9, 0.4, -0.3, 0.2])
    
    embeddingList2 = EmbeddingList()
    embeddingList2.add([-0.2, -0.2, 0.5, 0.6, 0.9])
    
    # a search with a single embedding list
    results = await async_client.search(
        collection_name="my_collection",
        data=[ embeddingList1,  embeddingList2],
        anns_field="chunks[text_vector]",
        search_params={"metric_type": "MAX_SIM_COSINE"},
        limit=3,
        output_fields=["chunks[text]"]
    )

asyncio.run(main())

The error message displayed is as follows:

RPC error: [search], <ParamError: (code=1, message=search_data value [EmbeddingList(count=1, dim=5, dtype=float32), EmbeddingList(count=1, dim=5, dtype=float32)] is illegal)>, <Time:{'RPC start': '2025-11-05 17:05:08.377588', 'RPC error': '2025-11-05 17:05:08.380136'}> (decorators.py:219)
Error in batch search: <ParamError: (code=1, message=search_data value [EmbeddingList(count=1, dim=5, dtype=float32), EmbeddingList(count=1, dim=5, dtype=float32)] is illegal)>

Additionally, I installed the Python client by running pip install pymilvus==2.6.3, but I cannot import EmbeddingList as shown in the documentation.

from pymilvus import EmbeddingList

but can only use such code to import EmbeddingList

from pymilvus.client.embedding_list import EmbeddingList

Expected Behavior

No response

Steps/Code To Reproduce behavior

Environment details

- Hardware/Softward conditions (OS, CPU, GPU, Memory): Centos 7.5
- Milvus version (v0.3.1, or v0.4.0): 2.6.4
- pymilvus version: 2.6.3

Anything else?

No response

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions