flushAll()
This operation flushes insert buffers for all collections in a database. Use it before backup, verification, or workflows that require all recent writes to be persisted.
public FlushAllResp flushAll(FlushAllReq request)
Request Syntax
flushAll(FlushAllReq.builder()
.databaseName(String databaseName)
.waitFlushedTimeoutMs(Long waitFlushedTimeoutMs)
.build());
BUILDER METHODS:
-
databaseName(String databaseName)The database whose collections should be flushed. Omit it to use the current database context.
-
waitFlushedTimeoutMs(Long waitFlushedTimeoutMs)How long to wait for the flush-all operation to finish. Values greater than zero enable synchronous waiting.
RETURN TYPE:
FlushAllResp
RETURNS:
A FlushAllResp object that contains the timestamp of the flush-all operation. The object exposes the following getters:
-
getFlushAllTs()(Long) -The timestamp of the flush-all operation.
EXCEPTIONS:
-
MilvusClientException
This exception will be raised when validation fails or the server returns an error for this operation.
Example
import io.milvus.v2.client.ConnectConfig;
import io.milvus.v2.client.MilvusClientV2;
import io.milvus.v2.service.utility.request.FlushAllReq;
import io.milvus.v2.service.utility.response.FlushAllResp;
ConnectConfig connectConfig = ConnectConfig.builder()
.uri("http://localhost:19530")
.token("root:Milvus")
.build();
MilvusClientV2 client = new MilvusClientV2(connectConfig);
FlushAllResp resp = client.flushAll(FlushAllReq.builder()
.databaseName("default")
.waitFlushedTimeoutMs(60000L)
.build());
System.out.println(resp.getFlushAllTs());