跳到主要内容
版本:v2.5.x

flush()

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

Java
public void flush(FlushReq request)

Request Syntax

Java
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

Java
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();
);