# System Operations

Look up the Milvus Node.js SDK methods for health checks, server versions, metrics, analyzer tests, and analyzer file resources.

SDK: `@zilliz/milvus2-sdk-node@3.0.10` · Tested with Milvus 3.0.6

Canonical documentation: https://milvus-io.github.io/milvus-sdk-node/api-reference/system/

## Section links

- [getVersion](https://milvus-io.github.io/milvus-sdk-node/api-reference/system/#getversion)
- [checkHealth](https://milvus-io.github.io/milvus-sdk-node/api-reference/system/#checkhealth)
- [Proxy administration](https://milvus-io.github.io/milvus-sdk-node/api-reference/system/#proxy-administration)
- [Client telemetry administration](https://milvus-io.github.io/milvus-sdk-node/api-reference/system/#client-telemetry-administration)
- [runAnalyzer](https://milvus-io.github.io/milvus-sdk-node/api-reference/system/#runanalyzer)
- [computePhraseMatchSlop](https://milvus-io.github.io/milvus-sdk-node/api-reference/system/#computephrasematchslop)
- [File resources](https://milvus-io.github.io/milvus-sdk-node/api-reference/system/#file-resources)
- [addFileResource](https://milvus-io.github.io/milvus-sdk-node/api-reference/system/#addfileresource)
- [listFileResources](https://milvus-io.github.io/milvus-sdk-node/api-reference/system/#listfileresources)
- [removeFileResource](https://milvus-io.github.io/milvus-sdk-node/api-reference/system/#removefileresource)
- [getMetric](https://milvus-io.github.io/milvus-sdk-node/api-reference/system/#getmetric)
- [Connection helpers](https://milvus-io.github.io/milvus-sdk-node/api-reference/system/#connection-helpers)
- [Related](https://milvus-io.github.io/milvus-sdk-node/api-reference/system/#related)

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

## getVersion

Get the connected Milvus server version.

```typescript
getVersion(): Promise<GetVersionResponse>
```

**Response**:

```typescript
interface GetVersionResponse {
  version: string;
}
```

Example:

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

## checkHealth

Check Milvus server health.

```typescript
checkHealth(): Promise<CheckHealthResponse>
```

**Response**:

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

Example:

```typescript
const health = await client.checkHealth();
if (!health.isHealthy) {
  console.warn('Milvus is unhealthy:', health.reasons);
}
```

## Proxy administration

- `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.

## Client telemetry administration

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.

## runAnalyzer

Test a text analyzer/tokenizer without inserting data.

```typescript
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**:

```typescript
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:

```typescript
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:

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

## computePhraseMatchSlop

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'`.

```typescript
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']
```

## File resources

 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

```typescript
addFileResource(data: AddFileResourceReq): Promise<ResStatus>
```

```typescript
await client.addFileResource({
  name: 'product_dictionary',
  path: 'analyzer-resources/product-dictionary.txt',
});
```

### listFileResources

```typescript
listFileResources(
  data?: ListFileResourcesReq
): Promise<ListFileResourcesResponse>
```

```typescript
const result = await client.listFileResources();
for (const resource of result.resources) {
  console.log(resource.id, resource.name, resource.path);
}
```

### removeFileResource

```typescript
removeFileResource(data: RemoveFileResourceReq): Promise<ResStatus>
```

```typescript
await client.removeFileResource({ name: 'product_dictionary' });
```

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

## getMetric

Get raw Milvus metrics.

```typescript
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:

```typescript
const metrics = await client.getMetric({
  request: { metric_type: 'system_info' },
});

console.log(metrics.component_name, metrics.response);
```

## Connection helpers

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

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

See [MilvusClient](https://milvus-io.github.io/milvus-sdk-node/api-reference/client/) for details.

## Related

- [API Reference overview](https://milvus-io.github.io/milvus-sdk-node/api-reference/)
- [Full-Text Search](https://milvus-io.github.io/milvus-sdk-node/advanced/full-text-search/)
- [Troubleshooting](https://milvus-io.github.io/milvus-sdk-node/reference/troubleshooting/)
- [Types & Enums](https://milvus-io.github.io/milvus-sdk-node/api-reference/types-and-enums/)
