Milvus
Zilliz
< Docs
  • Java

flush()

This operation flushes the streaming data onto the disk and seals the current segment.

public void flush(FlushReq request)

Request Syntax

flush(FlushReq.builder()
    .collectionNames(List<String>)
    .waitFlushedTimeoutMs(Long)
    .build()
)

BUILDER METHODS:

  • collectionNames(List<String>)

    The names of the the target collections.

  • waitFlushedTimeoutMs(Long)

    The timeout duration for the current operation in milliseconds.

RETURN TYPE:

void

RETURNS:

N/A

Example

import io.milvus.v2.client.ConnectConfig;
import io.milvus.v2.client.MilvusClientV2;
import io.milvus.v2.service.utility.request.FlushReq;

// 1. Set up a client
ConnectConfig connectConfig = ConnectConfig.builder()
        .uri("http://localhost:19530")
        .token("root:Milvus")
        .build();
        
MilvusClientV2 client = new MilvusClientV2(connectConfig);

// 2. Compact a collection
client.flush(FlushReq.builder()
    .collectionNames(Collections.singletonList("my_collection"))
    .build();
);

Try Managed Milvus for Free

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

Get Started
Feedback

Was this page helpful?