PyMilvus v2.6.3 Release Notes
Highlights
1. Support for Array of Structs
PyMilvus now supports array of structs data types, allowing you to store and query complex nested data structures.
from pymilvus import MilvusClient, DataType
client = MilvusClient(uri="http://localhost:19530")
schema = client.create_schema(auto_id=False)
schema.add_field(field_name="id", datatype=DataType.INT64, is_primary=True)
schema.add_field(field_name="vector", datatype=DataType.FLOAT_VECTOR, dim=128)
struct_schema = MilvusClient.create_struct_field_schema()
struct_schema.add_field(field_name="name", datatype=DataType.VARCHAR, max_length=100)
struct_schema.add_field(field_name="age", datatype=DataType.INT64)
struct_schema.add_field(field_name="text", datatype=DataType.VARCHAR, max_length=65535)
struct_schema.add_field(field_name="emb", datatype=DataType.FLOAT_VECTOR, dim=128)
schema.add_field(
field_name="user_info",
datatype=DataType.ARRAY,
element_type=DataType.STRUCT,
struct_schema=struct_schema,
max_capacity=1000,
)
client.create_collection(collection_name="users", schema=schema)
data = {
"id": 1,
"user_info": [
{"name": "Alice", "age": 30, "text": "this is alice", "emb": [0.1] * 128},
{"name": "Bob", "age": 20, "text": "this is bob", "emb": [0.2] * 128},
]
"vector": [0.1] * 128
}
client.insert(collection_name="users", data=[data])📖 Documentation Array of Structs, Compatible with Milvus 2.6.4+
2. Geometry Data Type Support
Query and search with geographic data using the new Geometry data type.
from pymilvus import MilvusClient, DataType
client = MilvusClient(uri="http://localhost:19530")
schema = MilvusClient.create_schema()
schema.add_field(field_name="id", datatype=DataType.INT64, is_primary=True)
schema.add_field(field_name="location", datatype=DataType.GEOMETRY, nullable=True)
schema.add_field(field_name="vector", datatype=DataType.FLOAT_VECTOR, dim=128)
client.create_collection(collection_name="geo_coll", schema=schema)
data = [
{"id": 1, "location": "POINT(116.404 39.915)", "vector": [0.1] * 128},
{"id": 2, "location": "POINT(-73.935 40.730)", "vector": [0.2] * 128}
]
client.insert(collection_name="locations", data=data)
results = client.query(
collection_name="locations",
filter=f'st_dwithin(location, "POINT(116.4 39.9)", 1000.0)',
output_fields=["id", "location"]
)📖 Documentation Geometry field, Compatible with Milvus 2.6.4+
3. Insert Primary Key with Auto ID Enabled
You can now insert custom primary keys even when auto_id is enabled, providing more flexibility in data management.
from pymilvus import MilvusClient, DataType
client = MilvusClient(uri="http://localhost:19530")
schema = MilvusClient.create_schema(auto_id=True)
schema.add_field(field_name="id", datatype=DataType.INT64, is_primary=True, auto_id=True)
schema.add_field(field_name="vector", datatype=DataType.FLOAT_VECTOR, dim=128)
client.create_collection(collection_name="my_collection", schema=schema, properties={"allow_insert_auto_id": "true"})
data = [
{"id": 100, "vector": [0.1] * 128},
{"id": 200, "vector": [0.2] * 128}
]
client.insert(collection_name="my_collection", data=data)📖 Documentation Insert when AutoID is true, Compatible with Milvus 2.6.3+
4. L0 Compaction Support
Trigger L0 compaction manually to optimize storage and query performance.
from pymilvus import MilvusClient
client = MilvusClient(uri="http://localhost:19530")
client.compact(collection_name="my_collection", is_l0=True)📖 Documentation Compact L0 segments, Compatible with Milvus 2.6.3+
5. ⚠️ Breaking Change: JSON Serialization for Strings
String values are now treated as JSON-serialized bytes. This is incompatible with previous versions.
Before (2.6.2 and earlier):
client.insert(collection_name="my_collection", data=[{"id": 1, "json_field": "a"}])Now (2.6.3+):
import json
client.insert(collection_name="my_collection", data=[{"id": 1, "json_field": json.dumps("a")}])Complete Change Log
Features
- Struct Support: SDK implementation for struct data type with field-level mmap configuration (#3026, #3037)
- Geo Data Type: Support for geographic data in insert, query, and search operations (#3043)
- L0 Compaction: Force L0 compact support (#3011)
- Function Scorer Ranker: Support using function scorer as ranker (#3010)
- Replicate Configuration: UpdateReplicateConfiguration API support (#3003)
Enhancements
- Async Client Improvements: Added retry mechanism and schema cache for AsyncMilvusClient (#3023)
- Allow user to insert primary key when auto_id is enabled (#3007)
- Update get_cost_from_status implementation (#3000)
- Enhanced remote storage usage result info (#3014)
- Remove annoying logs in MilvusClient (#3016)
- Raise error when ranker has unknown type (#3021)
- Support insert serialized JSON (#3031)
- Cherry pick multiple PRs from master branch (#3048)
Bug Fixes
- Fix hybrid_search to support EmbeddingList in request data (#3028)
Documentation
- Add apiKey note for bulk_import (#2997)
Contributors
Special thanks to all contributors who made this release possible:
@SpadeA-Tang, @XuanYang-cn, @aoiasd, @bigsheeper, @chasingegg, @lentitude2tk, @MrPresent-Han, @sunby, @xiaocai2333, @zhuwenxing
For more information, visit the PyMilvus GitHub repository.
Full Changelog: v2.6.2...v2.6.3