-
Notifications
You must be signed in to change notification settings - Fork 237
Expand file tree
/
Copy pathmilvus.py
More file actions
46 lines (31 loc) · 1.44 KB
/
milvus.py
File metadata and controls
46 lines (31 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from .document import DocumentArray
from .storage.milvus import StorageMixins, MilvusConfig
__all__ = ['MilvusConfig', 'DocumentArrayMilvus']
class DocumentArrayMilvus(StorageMixins, DocumentArray):
"""
DocumentArray that stores Documents in a `Milvus <https://milvus.io//>`_ vector search engine.
.. note::
This DocumentArray requires `pymilvus`. You can install it via `pip install "docarray[milvus]"`.
To use Milvus as storage backend, a Milvus service needs to be running on your machine.
With this implementation, :meth:`match` and :meth:`find` perform fast (approximate) vector search.
Additionally, search with filters is supported.
Example usage:
.. code-block:: python
from docarray import DocumentArray
# connect to running Milvus service with default configuration (address: http://localhost:19530)
da = DocumentArray(storage='milvus', config={'n_dim': 10})
# connect to a previously persisted DocumentArrayMilvus by specifying collection_name, host, and port
da = DocumentArray(
storage='milvus',
config={
'collection_name': 'persisted',
'host': 'localhost',
'port': '19530',
'n_dim': 10,
},
)
.. seealso::
For further details, see our :ref:`user guide <milvus>`.
"""
def __new__(cls, *args, **kwargs):
return super().__new__(cls)