milvus-logo
Star
0
Forks
0
Get Started

createIndex()

Create an index on a vector field. Note that index building is an async progress.

Invocation

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

Parameter

CreateIndexReq

ParameterDescriptiontyperequired
collection_nameCollection nameStringtrue
field_nameFiled namestringtrue
extra_paramsindex parametersShowCollectionsTypeIndexParams

IndexParams

ParameterDescriptiontyperequired
index_typeindex typeStringtrue
metric_typemetric typestringtrue
paramsindex parametersJsontrue

ShowCollectionsType

valueDescriptiontyperequired
0Allnumberfalse
1Loadednumberfalse

Example

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

Return

// showCollections return