FlushAsync()

Flushes the given collections, optionally waiting for the flush to complete.

public async Task<FlushResp> FlushAsync(FlushReq request, CancellationToken cancellationToken = default)

Request Syntax

var request = new FlushReq
{
    CollectionNames = ["my_collection"],
    WaitFlushedMs = 60000
};

FlushResp result = await client.FlushAsync(request);

REQUEST PARAMETERS:

  • DatabaseName (string?) -

    An optional database name to operate on. When empty, the client’s currently selected database is used.

  • CollectionNames (IReadOnlyList) -

    The names of the collections to flush.

  • WaitFlushedMs (long) -

    The maximum time in milliseconds to wait for the flush to complete. When zero (default), the flush waits forever until all segments are flushed. When greater than zero and the deadline elapses before all segments are flushed, FlushAsync throws TimeoutException.

RETURN TYPE:

Task

RETURNS:

A FlushResp object that contains the flush results for the given collections.

FlushResp
    DatabaseName     // -> string
    CollSegIDs       // -> IReadOnlyDictionary<string, IReadOnlyList<long>>
    FlushCollSegIDs  // -> IReadOnlyDictionary<string, IReadOnlyList<long>>
    CollSealTimes    // -> IReadOnlyDictionary<string, long>
    CollFlushTs      // -> IReadOnlyDictionary<string, ulong>

PARAMETERS:

  • DatabaseName (string) -

    The database that contains the flushed collections.

  • CollSegIDs (IReadOnlyDictionary>) -

    The segment IDs per collection.

  • FlushCollSegIDs (IReadOnlyDictionary>) -

    The set of segments actually flushed by this flush, per collection.

  • CollSealTimes (IReadOnlyDictionary) -

    The physical seal time per collection, used by backup tooling.

  • CollFlushTs (IReadOnlyDictionary) -

    The hybrid timestamp per collection, used to poll the flush state.

EXCEPTIONS:

  • MilvusException

    Thrown when the RPC fails or the server returns an error. Inspect the exception message for details.

Example

using Milvus.Client.V2;
using Milvus.Client.V2.Requests.Utility;
using Milvus.Client.V2.Responses.Utility;

using var client = new MilvusClientV2(new ConnectConfig
{
    Uri = "localhost:19530",
    Username = "root",
    Password = "Milvus"
});
await client.ConnectAsync();

FlushResp result = await client.FlushAsync(new FlushReq
{
    CollectionNames = ["my_collection"],
    WaitFlushedMs = 60000
});

Console.WriteLine($"Flushed segments for 'my_collection': {result.CollSegIDs["my_collection"].Count}");

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?