examples
examples copied to clipboard
when i insert vector to milvus,i get zero results, but the code is copied and pasted over.
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?
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 The above situation also occurs to me. How should I adjust it? Can you be more specific? What parameters should I change?
@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 Yes, I saw your answer in another question. Only by using collection.flush() can you see the number of insertions in collection.num_entities.
@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
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
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
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
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 What I installed is pymilvus 2.4.4
@junjiejiangjjj What I installed is pymilvus 2.4.4
I mean the milvus version, not pymilvus
@junjiejiangjjj The inserted data can be displayed in a list and can be added, deleted, checked and modified.