All Collections
Milvus
Concepts
How can documents be stored in Milvus?
How can documents be stored in Milvus?
Bakul Banthia avatar
Written by Bakul Banthia
Updated over a week ago

Milvus is primarily designed for storing and managing high-dimensional vectors, which are used to represent data points in a vector space. While it's not a traditional document store like a NoSQL database or a content management system, you can use Milvus to store and retrieve documents indirectly by representing them as vectors. Here's how you can store documents in Milvus:

  • Feature Extraction: To store documents in Milvus, you need to convert documents into high-dimensional vectors. This process involves feature extraction, which transforms the content of the documents into numerical features. Common techniques for feature extraction include:

    • Word Embeddings: You can use pre-trained word embeddings like Word2Vec, GloVe, or fastText to convert words in documents into dense vector representations. Then, you can aggregate word embeddings to represent entire documents.

    • TF-IDF (Term Frequency-Inverse Document Frequency): This method assigns numerical values to words based on their frequency in the document and importance in a corpus. It can be used to create numerical document representations.

    • Document Embeddings: Deep learning techniques, such as using pre-trained models like BERT or Doc2Vec, can directly create embeddings for entire documents.

  • Dimensionality Reduction: The vectors generated in the previous step can be quite high-dimensional. Depending on the use case, you may choose to apply dimensionality reduction techniques to reduce the vector dimensionality while preserving essential information.

  • Insert Vectors into Milvus: Once you have the document vectors, you can insert them into Milvus using its API. Milvus will store these vectors efficiently and provide indexing and search capabilities to retrieve them later based on their similarity to query vectors.

  • Querying Documents: To retrieve documents similar to a query, you need to convert the query into a vector using the same feature extraction and dimensionality reduction techniques. You can then perform similarity searches in Milvus to find documents with similar vectors.

  • Metadata: You can associate metadata with the vectors to store additional information about the documents. For example, you might store document IDs, titles, timestamps, and other relevant information in a separate database or data store and link them to the document vectors using unique identifiers.

By representing documents as vectors in Milvus, you can perform similarity searches, recommendations, and other content-based operations. This is often used in applications like content recommendation, content-based image retrieval, text search, and information retrieval systems, where you want to find similar documents based on their content.
The exact feature extraction and dimensionality reduction techniques you use will depend on your specific use case and the type of documents you are working with.

Did this answer your question?