see on GitHub

Commands: How to compact database?

To compact a database, please use compactDatabase command available in GlobalAdmin.

Syntax

public Operation compactDatabase(String databaseName);

Parameters
databaseName String Name of a database to compact

Example

Operation operation = store.getDatabaseCommands().getGlobalAdmin().compactDatabase("Northwind");
operation.waitForCompletion();

Remarks

Compacting operation is executed asynchronously and during this operation the database will be offline.