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

92 lines
1.3 KiB

# ANN Insert Operator: Milvus
3 years ago
*author: shiyu*
<br />
## Desription
Insert data into Milvus collections. **Please make sure you have [created Milvus Collection](https://milvus.io/docs/v2.0.x/create_collection.md)
and connected Milvus before loading the data.**
<br />
## Code Example
### Example
*Write the pipeline in simplified style:*
```python
import towhee
towhee.dc(your_embeddings) \
.ann_insert.milvus(uri='tcp://localhost:19530/my_collection')
```
*Write a same pipeline with explicit inputs/outputs name specifications:*
```python
import towhee
towhee.dc['vec'](your_embeddings) \
.ann_insert.milvus['vec', 'results'](uri='tcp://localhost:19530/my_collection') \
.show()
```
<img src="./result.png" height="150px"/>
### Load Collection
> Please load the Collection after inserted data.
```python
collection.load()
```
<br />
## Factory Constructor
Create the operator via the following factory method:
***ann_insert.milvus(collection)***
<br />
**Parameters:**
***uri:*** *str*
The uri for Milvus Collection, such as `tcp://<milvus-host>:<milvus-port>/<collection-name>`.
<br />
## Interface
**Parameters:**
***data:*** *list*
The embedding data to be inserted.
<br />
**Returns:** *mr*
Return milvus results with `milvus.insert`.