milvus-logo
LFAI
< Docs
  • Node

createIndex()

This method generates an index on a vector field. It is important to note that the index creation process is asynchronous.

Example

import { MilvusClient, MetricType, IndexType } from "@zilliz/milvus2-sdk-node";

new milvusClient(MILUVS_ADDRESS).createIndex({
  collection_name: "my_collection",
  field_name: "vector_01",
  index_name: "index_name",
  index_type: IndexType.IVF_FLAT,
  metric_type: MetricType.L2,
  params: { nlist: 10 },
});

Response

// createIndex returns
{ error_code: 'Success', reason: '' }

Parameters

ParametersDescriptionType
collection_nameCollection nameString
field_nameName of the field to create index onString
index_name?Name of the index to createString
extra_params?Extra index parameters (see the table below)IndexParams
index_typeIndex typeString
metric_typeMetric typeString
paramsIndex parametersObject
timeout?This parameter is used to specify the length of time, in milliseconds, that the RPC (Remote Procedure Call) is allowed to run. If no value is provided, the default is undefined.Number
Feedback

Was this page helpful?