logo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readme
Files and versions

52 lines
1.2 KiB

# ANN Search Operator: MilvusClient
2 years ago
*author: junjie.jiangjjj*
<br />
## Desription
Search embedding in [Milvus](https://milvus.io/), **please make sure you have inserted data to Milvus Collection**.
<br />
## Code Example
> Please make sure you have inserted data into Milvus, refer to [ann_insert.milvus_client](https://towhee.io/ann-insert/milvus-client) and [load the collection](https://milvus.io/docs/v2.1.x/load_collection.md) to memory.
```python
from towhee.dc2 import pipe, ops
p = pipe.input('vec') \
.map('vec', ('id', 'score'), ops.ann_search.milvus_client(host='127.0.0.1', port='19530', collection_name='textdb')) \
.output('id', 'score')
# call pipeline
p(vec_data)
```
```python
from towhee.dc2 import pipe, ops
# search additional info url:
p = pipe.input('vec') \
.map('vec', ('id', 'score', 'url'), ops.ann_search.milvus_client(host='127.0.0.1', port='19530', collection_name='textdb', output_fields=['url'])) \
.output('id', 'score', 'url')
```
<br />
## Factory Constructor
Create the operator via the following factory method:
***ann_search.milvus_client(host='127.0.0.1', port='19530', collection_name='textdb')***
<br />