Skip to main content

flush()

Addedv2.4.x

This operation flushes the streaming data and seals segments. It is not advised to call this operation after all the data has been inserted into a collection to avoid small segments, which may degrade search performance.

Request Syntax

flush(
self,
collection_name: str,
timeout: Optional[float] = None,
**kwargs,
)

PARAMETERS:

  • collection_name (str) -

    The name of the target collection.

  • timeout (Optional[float]) -

    The timeout duration for this operation.

    Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.

RETURN TYPE:

NoneType

RETURNS:

None

EXCEPTIONS:

  • MilvusException

    This exception will be raised when any error occurs during this operation, especially when the specified alias does not exist.

Example

from pymilvus import MilvusClient

# 1. Create a milvus client
client = MilvusClient(
uri="https://inxx-xxxxxxxxxxxx.api.gcp-us-west1.zillizcloud.com:19530",
token="user:password"
)

client.flush(
collection_name="collection_name"
)