examples icon indicating copy to clipboard operation
examples copied to clipboard

when i insert vector to milvus,i get zero results, but the code is copied and pasted over.

Open xiangcaoximilu opened this issue 1 year ago • 11 comments

image

When i configured the environment, i copy the code and still get zero results? i don't know...how to say..

i am performing the operation to insert the vector into milvus collection..get zero?

xiangcaoximilu avatar Jul 18 '24 11:07 xiangcaoximilu

The interface for obtaining the number of milvus data in the code example is inaccurate. As long as there is no error during operation, it is inserted.

junjiejiangjjj avatar Jul 18 '24 11:07 junjiejiangjjj

@junjiejiangjjj The above situation also occurs to me. How should I adjust it? Can you be more specific? What parameters should I change?

watertianyi avatar Sep 11 '24 08:09 watertianyi

@junjiejiangjjj The above situation also occurs to me. How should I adjust it? Can you be more specific? What parameters should I change?

The data has been inserted successfully. You can use the following code to view the actual number.

from pymilvus import MilvusClient

client = MilvusClient(
    uri="http://localhost:19530"
)

res = client.query(
    collection_name="you collection name",
    output_fields=["count(*)"]
)

print(res)

Or you can also view information through this project: https://github.com/zilliztech/attu

junjiejiangjjj avatar Sep 11 '24 09:09 junjiejiangjjj

@junjiejiangjjj Yes, I saw your answer in another question. Only by using collection.flush() can you see the number of insertions in collection.num_entities.

watertianyi avatar Sep 11 '24 09:09 watertianyi

@junjiejiangjjj我也遇到上述情况了,该怎么调整?能具体说一下吗?要改哪些参数?

数据已插入成功,您可以使用以下代码查看实际数量。

from pymilvus import MilvusClient

client = MilvusClient(
    uri="http://localhost:19530"
)

res = client.query(
    collection_name="you collection name",
    output_fields=["count(*)"]
)

print(res)

或者您也可以通过这个项目查看信息:https://github.com/zilliztech/attu

RPC error: [query], <MilvusException: (code=1, message=query expression is empty)>, <Time:{'RPC start': '2024-09-12 15:23:42.587309', 'RPC error': '2024-09-12 15:23:42.587895'}> Failed to query collection: reverse_image_search1

watertianyi avatar Sep 12 '24 07:09 watertianyi

RPC error: [query], <MilvusException: (code=1, message=query expression is empty)>, <Time:{'RPC start': '2024-09-12 15:23:42.587309', 'RPC error': '2024-09-12 15:23:42.587895'}> Failed to query collection: reverse_image_search1

Update pymilvus. I can run it with version 2.4.4 of pymilvus.

junjiejiangjjj avatar Sep 12 '24 08:09 junjiejiangjjj

@junjiejiangjjj Still the same 2024-09-12 17:19:09,889 - 140641356620160 - milvus_client.py-milvus_client:519 - DEBUG: Created new connection using: f650d41aab1342b68293b8dae4224bfc 2024-09-12 17:19:09,892 - 140641356620160 - decorators.py-decorators:108 - ERROR: RPC error: [query], <MilvusException: (code=1, message=query expression is empty)>, <Time:{'RPC start': '2024-09-12 17:19:09.891481', 'RPC error': '2024-09-12 17:19:09.892405'}> 2024-09-12 17:19:09,892 - 140641356620160 - milvus_client.py-milvus_client:301 - ERROR: Failed to query collection: reverse_image_search1 Unexpected exception formatting exception. Falling back to standard exception Traceback (most recent call last): File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3505, in run_code # on runtime, and also because if any node in the node list is File "/tmp/ipykernel_2590518/3210487239.py", line 7, in res = client.query( File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/pymilvus/milvus_client/milvus_client.py", line 302, in query output_fields (List[str], optional): List of which field values to return. If None File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/pymilvus/milvus_client/milvus_client.py", line 295, in query In order for the search to process, a collection needs to have been either provided File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/pymilvus/decorators.py", line 109, in handler ) from e File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/pymilvus/decorators.py", line 105, in handler if timeout(start_time): File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/pymilvus/decorators.py", line 136, in handler def handler(*args, **kwargs): File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/pymilvus/decorators.py", line 85, in handler while True: File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/pymilvus/decorators.py", line 50, in handler def wrapper(func: Any): File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/pymilvus/client/grpc_handler.py", line 988, in query pymilvus.exceptions.MilvusException: <MilvusException: (code=1, message=query expression is empty)>

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 2102, in showtraceback simply call this method.""" File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/IPython/core/ultratb.py", line 1310, in structured_traceback long_header=long_header, include_vars=include_vars, File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/IPython/core/ultratb.py", line 1199, in structured_traceback etype, evalue, etb = exception File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/IPython/core/ultratb.py", line 1052, in structured_traceback # some locals File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/IPython/core/ultratb.py", line 978, in format_exception_as_a_whole exc = '%s%s%s' % (colors.excName, etype, colorsnormal) File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/IPython/core/ultratb.py", line 878, in format_record lineno=frame_info.lineno, File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/IPython/core/ultratb.py", line 712, in lines def show_exception_only(self, etype, evalue): File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/stack_data/utils.py", line 144, in cached_property_wrapper File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/stack_data/core.py", line 734, in lines pieces = self.included_pieces File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/stack_data/utils.py", line 144, in cached_property_wrapper File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/stack_data/core.py", line 681, in included_pieces pos = scope_pieces.index(self.executing_piece) File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/stack_data/utils.py", line 144, in cached_property_wrapper File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/stack_data/core.py", line 660, in executing_piece return only( File "/home/hjq/anaconda3/envs/image_search/lib/python3.9/site-packages/executing/executing.py", line 116, in only raise NotOneValueFound('Expected one value, found 0') executing.executing.NotOneValueFound: Expected one value, found 0

watertianyi avatar Sep 12 '24 09:09 watertianyi

Maybe you are using an older version of milvus. Try this: https://milvus.io/api-reference/pymilvus/v2.4.x/ORM/Collection/flush.md

junjiejiangjjj avatar Sep 12 '24 11:09 junjiejiangjjj

@junjiejiangjjj What I installed is pymilvus 2.4.4

watertianyi avatar Sep 12 '24 12:09 watertianyi

@junjiejiangjjj What I installed is pymilvus 2.4.4

I mean the milvus version, not pymilvus

junjiejiangjjj avatar Sep 12 '24 12:09 junjiejiangjjj

@junjiejiangjjj The inserted data can be displayed in a list and can be added, deleted, checked and modified.

watertianyi avatar Sep 16 '24 12:09 watertianyi