Build an Index

This page will show you how to create an index for a specified field in a collection to accelerate vector similarity search. See Vector Index for more information about setting index parameters.

Parameters marked with * are specific to Python SDK, and those marked with ** are specific to Node.js SDK.

  1. Prepare the index parameters:
>>> index_param = {
const index_param = {
  metric_type: "L2",
  index_type: "IVF_FLAT",
  params: JSON.stringify({ nlist: 1024 }),
Detailed Description
Parameter Description Note
metric_type Metrics used to measure similarity of vectors Find more options in Simlarity Metrics.
index_type Type of index used to accelerate the vector search Find more options in Index Selection.
params Building parameter(s) specific to the index Find more parameter details of different indexes in Index Selection.
  1. Build an index:
>>> collection.create_index(field_name=field_name, index_params=index_param)
Status(code=0, message='')
await milvusClient.indexManager.createIndex({
  collection_name: COLLECTION_NAME,
  field_name: FIELD_NAME,
  extra_params: index_param,
  1. View index details:
>>> collection.index().params
{'metric_type': 'L2', 'index_type': 'IVF_FLAT', 'params': {'nlist': 1024}}
await milvusClient.indexManager.describeIndex({
  collection_name: COLLECTION_NAME,
Is this page helpful?
Scored Successfully!