get_compaction_plans()
This operation gets the current compaction plans.
Request Syntax
get_compaction_plans(
timeout: Optional[float] = None,
is_clustering: Optional[bool] = False,
**kwargs
) -> CompactionPlans
PARAMETERS:
timeout (float | None)
The timeout duration for this operation. Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.
is_clustering (bool) -
Whether to fetch the plans of a clustering compaction. Defaults to False.
RETURN TYPE:
CompactionPlans
RETURNS:
A CompactionPlans object containing compaction_id, collection_name, state, and plans. Each plan includes sources, target, targets, plan_id, trigger_id, collection_id, partition_id, channel, compaction_type, state, and failure_reason.
EXCEPTIONS:
MilvusException
This exception will be raised when any error occurs during this operation.
Examples
from pymilvus import Collection, CollectionSchema, FieldSchema, DataType
schema = CollectionSchema([
FieldSchema("id", DataType.INT64, is_primary=True),
FieldSchema("vector", DataType.FLOAT_VECTOR, dim=5)
])
# Create a collection
collection = Collection(
name="test_collection",
schema=schema
)
# Compact small segments
collection.compact()
# Check the compaction state
collection.get_compaction_plans()
# Compaction Plans:
# - compaction id: 446738261026576357
# - state: Completed
# - plans: []
Related operations
The following operations are related to get_compaction_plans():