Skip to content
MilvusNode SDK
Sections

System Operations

Markdown

Copy for agent

System APIs expose connection context, server status, analyzer testing, analyzer file resources, and server metrics.

Get the connected Milvus server version.

getVersion(): Promise<GetVersionResponse>

Response:

interface GetVersionResponse {
version: string;
}

Example:

const version = await client.getVersion();
console.log(version.version);

Check Milvus server health.

checkHealth(): Promise<CheckHealthResponse>

Response:

interface CheckHealthResponse {
isHealthy: boolean;
reasons: [];
}

Example:

const health = await client.checkHealth();
if (!health.isHealthy) {
console.warn('Milvus is unhealthy:', health.reasons);
}
  • allocTimestamp() returns a Milvus hybrid timestamp as a decimal string with the default gRPC loader settings.
  • getComponentStates() returns the proxy role, node ID, and health state.
  • registerLink() returns status from the legacy proxy link registration RPC. Millvus 3.0.6 may omit the address.
  • dummy({ request_type }) sends a JSON string to the legacy diagnostic RPC and returns the server’s JSON response string.

These gRPC methods accept an optional timeout in milliseconds and were verified on Milvus 3.0.6.

Use getClientTelemetry({ client_id, database, include_metrics }) to query server-reported client telemetry. The default gRPC loader returns counters and heartbeat timestamps as decimal strings.

Use pushClientCommand() to queue a command. Pass target_client_id or target_database to scope delivery, and pass the payload as bytes. Use the returned command_id with deleteClientCommand() to remove the command. Milvus supports persistent push_config commands.

Milvus 3.0.6 requires a root connection for these methods when authorization is enabled.

Test a text analyzer/tokenizer without inserting data.

runAnalyzer(data: RunAnalyzerRequest): Promise<RunAnalyzerResponse>

Parameters:

  • text: Text string or array of text strings to analyze.
  • analyzer_params?: Analyzer configuration for ad-hoc analysis.
  • with_detail?: Return detailed token data.
  • with_hash?: Return token hash values.
  • db_name?: Database name when using analyzers configured on a collection field.
  • collection_name?: Collection name when using analyzers configured on a collection field.
  • field_name?: Field name when using analyzers configured on a collection field.
  • analyzer_names?: Analyzer names configured on the field.

Response:

type AnalyzerToken = {
token: string;
start_offset: number;
end_offset: number;
position: number;
position_length: number;
hash: number;
};
interface RunAnalyzerResponse {
status: ResStatus;
results: { tokens: AnalyzerToken[] }[];
}

Example with ad-hoc analyzer params:

const analyzed = await client.runAnalyzer({
text: ['The quick brown fox', 'jumps over Milvus'],
analyzer_params: {
tokenizer: 'standard',
filter: ['lowercase'],
},
with_detail: true,
});

Example using a collection field analyzer:

const analyzed = await client.runAnalyzer({
text: 'vector database search',
db_name: 'default',
collection_name: 'books',
field_name: 'title',
analyzer_names: ['default'],
with_detail: true,
});

Measure how far phrase terms are separated in each input text using the specified analyzer. An omitted analyzer_params uses Milvus’s default analyzer. The response keeps the input order and returns decimal slop strings. A nonmatch has is_match: false and slop '-1'.

const result = await client.computePhraseMatchSlop({
analyzer_params: { type: 'standard' },
query_text: 'red fox',
data_texts: ['red fox', 'red swift fox', 'a fox'],
});
// result.is_match is [true, true, false]
// result.slops is ['0', '1', '-1']
Milvus 3.0

Register server-visible files for analyzers that use custom dictionaries or other external text resources. The path is resolved by Milvus storage; it is not uploaded from the Node.js process.

addFileResource(data: AddFileResourceReq): Promise<ResStatus>
await client.addFileResource({
name: 'product_dictionary',
path: 'analyzer-resources/product-dictionary.txt',
});
listFileResources(
data?: ListFileResourcesReq
): Promise<ListFileResourcesResponse>
const result = await client.listFileResources();
for (const resource of result.resources) {
console.log(resource.id, resource.name, resource.path);
}
removeFileResource(data: RemoveFileResourceReq): Promise<ResStatus>
await client.removeFileResource({ name: 'product_dictionary' });

File resource requests accept an optional timeout. Removing a resource does not delete the underlying object from storage.

Get raw Milvus metrics.

getMetric(data: GetMetricsRequest): Promise<GetMetricsResponse>

Parameters:

  • request.metric_type: 'system_info', 'system_statistics', or 'system_log'.
  • timeout?: Request timeout in milliseconds.

Response:

  • status: Response status.
  • component_name: Component that returned the metrics.
  • response: Parsed JSON metrics payload.

Example:

const metrics = await client.getMetric({
request: { metric_type: 'system_info' },
});
console.log(metrics.component_name, metrics.response);

These are available on MilvusClient because it extends the underlying gRPC client:

use(data?: { db_name: string }): Promise<ResStatus>
useDatabase(data?: { db_name: string }): Promise<ResStatus> // alias
closeConnection(): Promise<CONNECT_STATUS>
reconnectToPrimary(): Promise<boolean>

See MilvusClient for details.