milvus-logo
LFAI
< Docs
  • Node

createIndex()

This method creates an index on a vector field. Note that the index building process is an asynchronous.

Invocation

new milvusClient(MILUVS_ADDRESS).collectionManager.createIndex(CreateIndexReq);

Parameters

CreateIndexReq

ParameterDescriptionTypeRequired
collection_nameCollection nameStringTrue
field_nameName of the field to create index onStringTrue
index_nameName of the index to createStringFalse
extra_paramsExtra index parameters (see the table below)IndexParamsFalse

IndexParams

ParameterDescriptionTypeRequired
index_typeIndex typeStringTrue
metric_typeMetric typeStringTrue
paramsIndex parametersJsonTrue

Example

new milvusClient(MILUVS_ADDRESS).indexManager.createIndex({
  collection_name: 'my_collection',
  field_name: "vector_01",
  extra_params: {
    index_type: "IVF_FLAT",
    metric_type: "IP",
    params: JSON.stringify({ nlist: 10 }),
  },
});

Return

// createIndex return
{ error_code: 'Success', reason: '' }
Feedback

Was this page helpful?