Skip to content

fix: remove embedding vector from Milvus search output_fields#265

Open
octo-patch wants to merge 1 commit into
zilliztech:masterfrom
octo-patch:fix/issue-238-remove-embedding-from-search-output-fields
Open

fix: remove embedding vector from Milvus search output_fields#265
octo-patch wants to merge 1 commit into
zilliztech:masterfrom
octo-patch:fix/issue-238-remove-embedding-from-search-output-fields

Conversation

@octo-patch
Copy link
Copy Markdown

Fixes #238

Problem

In some Milvus configurations (e.g. Milvus docker standalone, Milvus server deployments), requesting the embedding vector field as an output field in client.search() raises:

MilvusException: (code=65535, message=field embedding not exist)

This causes search_data() to fail entirely, making the whole query pipeline crash with a RuntimeError.

Root Cause

The output_fields=["embedding", "text", "reference", "metadata"] parameter requests the dense vector field back from Milvus. Some Milvus versions or server configurations do not support returning vector fields via output_fields, resulting in the above exception.

Importantly, RetrievalResult.embedding is never used downstream — it only appears in __repr__(). No agent code reads the embedding from search results, making this retrieval unnecessary and wasteful (embeddings can be thousands of floats per result).

Solution

  • Remove "embedding" from output_fields in both regular search and hybrid search calls
  • Pass None for the embedding parameter when constructing RetrievalResult

This eliminates the exception, reduces data transfer from Milvus, and has no functional impact since the embedding value from search results is never consumed.

Testing

Verified against existing tests/vector_db/test_milvus.py test suite — test_search_data passes as before since it only checks the result is a RetrievalResult instance, not its embedding value.

…ech#238)

The embedding vector field is not needed in search results since
RetrievalResult.embedding is only used in __repr__ and not consumed
by any downstream agent code. Requesting it in output_fields causes
MilvusException (code=65535, message=field embedding not exist) in
certain Milvus versions/configurations (e.g. Milvus docker standalone).

Pass None for embedding in RetrievalResult to maintain API compatibility.

Co-Authored-By: Octopus <liyuan851277048@icloud.com>
@sre-ci-robot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: octo-patch
To complete the pull request process, please assign xiaofan-luan after the PR has been reviewed.
You can assign the PR to them by writing /assign @xiaofan-luan in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RuntimeError: fail to search data, error info: <MilvusException: (code=65535, message=field embedding not exist)>

2 participants