Skip to content

Bug: Pipeline drops entire Milvus collection on every run #10

Closed as not planned

Description

@haroon0x

The Problem

In pipelines/kubeflow-pipeline.py:

if utility.has_collection(collection_name):
    utility.drop_collection(collection_name)
    print(f"Dropped existing collection: {collection_name}")

Every pipeline run deletes ALL data and rebuilds from scratch. This means:

  • You can't index multiple data sources (docs + issues)
  • Re-running causes temporary data loss

Why This Matters for Agentic RAG

The Agentic RAG GSoC proposal requires indexing multiple data sources:

  • Kubeflow documentation
  • GitHub Issues (for troubleshooting)
  • Platform architecture docs

With the current code, running the issues pipeline would delete all docs. This blocks the proposal entirely. Fixing this is a prerequisite for building a multi-source RAG agent.

Proposed Solutions

Option 1: Source-Based Delete

Add a source field to every record, then delete only matching records before inserting.

# Delete old data from this source only
collection.delete(expr=f'source == "docs:kubeflow/website"')
# Insert new data
collection.insert(records)

Pros: Simple concept.
Cons: Requires schema change, delete-by-expression scans all rows.


Option 2: Milvus Partitions (Recommended)

Docs (https://milvus.io/docs/manage-partitions.md#Create-Partition)
Milvus has a first-class feature for this: Partitions. A partition is a subdivision of a collection that can be dropped/created independently.

Collection: docs_rag
├── Partition: docs__kubeflow_website     (docs)
├── Partition: issues__kubeflow_kubeflow  (issues)
└── Partition: issues__kubeflow_pipelines (issues)

Each pipeline run only drops and rebuilds its own partition:

partition_name = f"{source_type}__{repo_name.replace('/', '_')}"

# Drop only this partition
if collection.has_partition(partition_name):
    collection.drop_partition(partition_name)

# Create and populate
collection.create_partition(partition_name)
collection.insert(records, partition_name=partition_name)

Pros:

  • No schema change needed
  • O(1) drop (instant, no scanning)
  • Milvus-native feature designed for this
  • Search still works across all partitions automatically
# Searches ALL partitions automatically
collection.search(query_vec, ...)

Questions for Maintainers

  1. Any concerns with switching to a partitioned collection?
  2. Preference between Option 1 and Option 2?

I am happy to implement whichever approach makes sense.

Activity

  1. changed the title [-]Pipeline drops entire Milvus collection on every run[/-] [+]Bug: Pipeline drops entire Milvus collection on every run[/+] on Jan 30, 2026
  2. Sayan4496 commented on Jan 30, 2026

    @Sayan4496

    Thanks for raising this — I agree this is a blocker for multi-source RAG.

    Partition-based ingestion (Option 2) seems like the cleanest Milvus-native approach:

    • avoids deleting the whole collection
    • supports multiple sources (docs/issues/platform) safely
    • makes re-index runs isolated and fast (drop partition O(1))
    • no schema change needed

    I’m happy to implement partition support in store_milvus + pipeline wiring (partition_name derived from source_type + repo).
    If maintainers agree, I can open a PR with:

    1. partition_name parameter for store_milvus
    2. create/drop only that partition
    3. run docs + issues ingestion into same collection but separate partitions
  3. haroon0x commented on Jan 30, 2026

    @haroon0x
    ContributorAuthor

    Thanks for confirming @Sayan4496
    I’ve implemented the partition-based approach and linked the PR with the changes to store_milvus and the pipeline.
    Let me know if you have any feedback.

  4. chasecadet commented on Nov 20, 2026

    @chasecadet
    Contributor

    Thank you for reporting this!

    We are closing pre-restructure issues targeting the legacy server/, server-https/, manifests/, kagent-feast-mcp/, or in-process SentenceTransformer prototype code. In #207, #210, #233, #240, and #249, kubeflow/docs-agent migrated to dedicated TEI (text-embeddings-inference), FastMCP (docs-agent-mcp/mcp-server/), shared modular KFP pipelines (docs-agent-mcp/pipelines/), and Helm charts (docs-agent-mcp/charts/).

    If you still observe an equivalent issue on the current main stack, please feel free to open a new issue using the current issue templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions