Milvus Vector Store Integration is Breaking | Metric Type maybe required!

First off, this isn’t unique to n8n, other platforms have the same problem. I think this has more to do with the API specification of the Milvus Vector Store.

Issue:

When running an agent, queries to the Milvus Vector store fail with the following error (below). The Milvus query seems to be breaking because it’s querying the vector store with a distance metric that is different from what’s originally set on the target vector store. In this case, COSINE metric conflicts with L2.

I looked up the V2 API documentation for Milvus and it seems to be confusing.

The first issue here is that the metricType parameter is optional. And the description of this attribute contradicts itself by stating that the metricType in the query must match with that of the target collection.

The problem is more on the Milvus end because if it has made this attribute optional, then it must deal with the requests coming in with different metricType.

At the same time, client APIs must specify the metricType attribute for their searches to run error free.

Question:
Would it be possible to have the Milvus connector in n8n to be enhanced to add the metricType attribute in the connector setup?

Thanks!

{
  "errorMessage": "Error searching data: {\"status\":{\"extra_info\":{},\"error_code\":\"UnexpectedError\",\"reason\":\"fail to search on QueryNode 2: worker(2) query failed: metric type not match: invalid parameter[expected=COSINE][actual=L2]\",\"code\":65535,\"retriable\":false,\"detail\":\"failed to search: failed to search/query delegator 2 for channel by-dev-rootcoord-dml_11_460476531099887932v0: fail to search on QueryNode 2: worker(2) query failed: metric type not match: invalid parameter[expected=COSINE][actual=L2]\"},\"results\":[],\"recalls\":[],\"session_ts\":-1,\"collection_name\":\"milvus_dox_collection\",\"search_iterator_v2_results\":null,\"_search_iterator_v2_results\":null}",
  "errorDescription": "Error searching data: {\"status\":{\"extra_info\":{},\"error_code\":\"UnexpectedError\",\"reason\":\"fail to search on QueryNode 2: worker(2) query failed: metric type not match: invalid parameter[expected=COSINE][actual=L2]\",\"code\":65535,\"retriable\":false,\"detail\":\"failed to search: failed to search/query delegator 2 for channel by-dev-rootcoord-dml_11_460476531099887932v0: fail to search on QueryNode 2: worker(2) query failed: metric type not match: invalid parameter[expected=COSINE][actual=L2]\"},\"results\":[],\"recalls\":[],\"session_ts\":-1,\"collection_name\":\"milvus_dox_collection\",\"search_iterator_v2_results\":null,\"_search_iterator_v2_results\":null}",
  "errorDetails": {},
  "n8nDetails": {
    "time": "9/1/2025, 1:40:33 PM",
    "n8nVersion": "1.108.2 (Self Hosted)",
    "binaryDataMode": "default"
  }
}
1 Like

Hello, I face exactly the same issue, who will fix it ?

Well, I did provide feedback to n8n about the connector from within the dev environment.

In my opinion, Milvus has already enhanced their API and they aren’t going to roll it back. Therefore, the clients using the api must enhance the tool to be able to use the latest Milvus API.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.