Reputation: 85
I am using Milvus 2.4.0, and I encounter an issue when performing a collection search. The collection query works fine, but when I attempt a search, I receive the following errors:
[2024-08-07 10:53:27,109] WARNING in decorators: [search] retry:9, cost: 3.00s, reason: <_InactiveRpcError: StatusCode.UNAVAILABLE, failed to connect to all addresses; last error: UNKNOWN: ipv4:172.16.200.46:19530: Failed to connect to remote host: Connection refused>
[2024-08-07 10:53:30,126] ERROR in decorators: RPC error: [search], <MilvusException: (code=101, message=failed to search: collection not loaded[collection=451674119090946895])>, <Time:{'RPC start': '2024-08-07 10:53:17.306848', 'RPC error': '2024-08-07 10:53:30.126018'}>
Here is my code:
from config.config import *
from pymilvus import (
connections, utility, Collection, FieldSchema, CollectionSchema, DataType)
connections.connect("default", host=MILVUS_HOST, port=MILVUS_PORT)
collection = Collection(COLLECTION_NAME)
collection.load()
list_collection = utility.list_collections()
# Query works fine
res_query = collection.query(
expr="id > 1",
output_fields=['id'],
timeout=5.0
)
# Search raises error
img = cv2.imread('image_test/test.png')
embedding_vec = feature_extraction(img)
search_params = {"metric_type": "COSINE", "params": {"nprobe": 10}}
res_search = collection.search(
data=[embedding_vec],
anns_field="vector",
param=search_params,
expr="active in [1]",
output_fields=['id'],
limit=TOP_K)
I have verified that the collection is loaded using collection.load()
and confirmed the connection to the server using connections.connect.
Why is the search failing with connection refused and collection not loaded errors, even though the query works? Are there additional steps I need to take to ensure the collection is properly loaded for a search?
Here is my environment details FYI:
Milvus Version: 2.4.0
Host: ipv4:172.16.200.46:19530
Upvotes: 1
Views: 385