AI

Milvus Drop Index

Milvus is an open-source vector database for large-scale machine learning and data analytics workloads. It provides an efficient storage and retrieval of high-dimensional vectors that represent the complex data such as images, text, and audio.

Milvus utilizes a data structure called the vector index which organizes and indexes the vectors to enable a fast similarity search. The index employs the advanced algorithms, such as approximate nearest neighbor (ANN) search techniques, to quickly find the vectors that are similar or close in the distance to a given query vector.

In this tutorial, we will learn how to create and drop a collection index in the Milvus database using the Milvus CLI.

Prerequisites:

  1. Access to a Milvus server
  2. Installed Milvus CLI on your local machine

With the given requirements met, we can proceed to the next steps.

Create a Collection in Milvus CLI

The first step is to create a collection for demonstration purposes. Start by logging to the Milvus CLI and run the following command:

milvus_cli > create collection -c car -f id:INT64:primary_field -f vector:FLOAT_VECTOR:128 -f color:INT64:color -f brand:INT64:brand -p id -a -d 'car_collection'

 

This should create a simple “car” collection.

Create an Index in Milvus

Once you configure the collection, run the “create index” command to configure a new index. Ensure to follow the provided prompts.

milvus_cli > create index
Collection name (car, car2): car

The name of the field to create an index for (vector): vector
Index name: vectorIndex
Index type (FLAT, IVF_FLAT, IVF_SQ8, IVF_PQ, RNSG, HNSW, ANNOY): IVF_FLAT
Index metric type (L2, IP, HAMMING, TANIMOTO): L2
Index params nlist: 2
Timeout []:

 

Milvus CLI Drop Index

Once you finish the index, you can remove it from the server using the “delete index” command. You can use the command syntax as shown in the following:

delete index -c (text) -in (text) [-t (float)]

 

The -c parameter denotes the collection name, and the -in parameter denotes the index name that you wish to remove.

For example, you can use the following command:

milvus_cli > delete index -c car -in vectorIndex

 

The previous command removes the “vectorIndex” index from the specified collection.

Conclusion

This tutorial explored the basics of working with a given collection using the Milvus CLI commands.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list