Script icon
If icon
SlackIncomingWebhook icon
Log icon
Return icon
Schedule icon

Milvus Collection Index State and Unindexed Entity Sentinel

Audits Milvus vector database collections for failed index builds, unindexed growing segments, and search degradation with automated alerts.

Categories
AIData

Audits Milvus distributed vector database HTTP management endpoints to verify collection index construction, identify failed HNSW or IVF index builds, and track unindexed entity backlogs.

How it works

  1. The hourly_milvus_audit schedule trigger initiates the collection inspection once every hour.
  2. The audit_milvus_indexes task queries the Milvus API to inspect collection schemas, vector field index states, and growing segment counts.
  3. The check_indexing_health flowable evaluates whether any index failed to finish or if unindexed entities in growing segments breach the safety threshold.
  4. If degradation is detected, notify_slack_ai_platform sends an urgent diagnostic report to the AI Platform Slack channel.
  5. If all vector indexes are finished and healthy, log_healthy_milvus logs nominal status.
  6. The export_milvus_manifest task records an execution summary payload.

Architecture diagram

flowchart TD
    T[Schedule: hourly_milvus_audit] --> S[audit_milvus_indexes]
    S --> C{check_indexing_health}
    C -- Degraded --> A[notify_slack_ai_platform]
    C -- Healthy --> H[log_healthy_milvus]
    A --> E[export_milvus_manifest]
    H --> E[export_milvus_manifest]

Use cases

  • Enterprise RAG Latency Defense: Prevents vector search queries from reverting to expensive brute-force scans when automated index building fails.
  • Continuous Ingestion Safeguard: Ensures streaming ingestion pipelines do not accumulate massive uncompacted segments that exhaust query node memory.
  • Multi-Tenant AI Platform Governance: Verifies that dynamically provisioned collections build required HNSW or SCANN indexes before servicing user traffic.

Inputs

Name Type Default Description
milvus_endpoint STRING http://milvus-standalone.internal:19530 Base HTTP or gRPC management endpoint of the Milvus vector database cluster.
milvus_api_key SECRET (optional) Secret containing the optional token or API key for Milvus authentication.
collection_filter STRING "" Optional substring filter for Milvus collection names to inspect.
max_unindexed_entities_threshold INT 5000 Maximum permissible entities residing in unindexed growing segments before alerting.
alert_on_failed_indexes BOOL true Whether to alert immediately if any vector index build has failed or stalled.

Expected outputs

  • outputs.audit_milvus_indexes.vars.total_audited: Number of collections inspected.
  • outputs.audit_milvus_indexes.vars.failed_indexes_count: Count of collections with unbuilt or failed vector indexes.
  • outputs.audit_milvus_indexes.vars.high_unindexed_count: Collections with growing entities exceeding threshold.
  • outputs.audit_milvus_indexes.vars.degraded: Boolean flag indicating vector search performance degradation.
  • outputs.export_milvus_manifest.value: Formatted execution report summary.

Prerequisites

  • Network connectivity from Kestra workers to the Milvus HTTP endpoint (typically port 19530).
  • Milvus 2.3+ with RESTful v2 API enabled.
  • Slack incoming webhook endpoint configured.

Secrets

  • SLACK_WEBHOOK_URL: Secret containing the Slack incoming webhook endpoint for channel alerts.
  • MILVUS_API_KEY: Secret containing the Milvus bearer token or root password if authentication is enabled.

Quick start

  1. Define SLACK_WEBHOOK_URL and MILVUS_API_KEY in your Kestra namespace secrets.
  2. Adjust milvus_endpoint to point to your Milvus standalone or distributed proxy address.
  3. Run a manual execution to test collection discovery and verify index states.
  4. Enable the hourly_milvus_audit schedule for automated cluster surveillance.

Common pitfalls and troubleshooting

  • Growing vs Sealed Segments: Entities freshly inserted enter growing segments and are not indexed until flushed into sealed segments. Small unindexed counts are expected during active ingestion.
  • Authentication Disabled by Default: If Milvus has authorization disabled, leave milvus_api_key empty.
  • AutoIndex in Milvus 2.4: Collections configured with AutoIndex manage parameters automatically, but still transition through InProgress and Finished states.

How to extend

  • Trigger automated index recreation via Milvus REST API create_index when corrupted states occur.
  • Automate collection manual compaction when fragment counts trigger query latency warnings.
  • Publish index build durations to Prometheus or Grafana to track embedding cluster efficiency.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.