milvus-logo
Star
0
Forks
0
Get Started

createCollection()

Creates a collection with the specified schema.

Invocation

new milvusClient(MILUVS_ADDRESS).collectionManager.createCollection(CreateCollectionReq);

Parameter

CreateCollectionReq(object)

ParameterDescriptiontyperequired
collection_nameCollection nameStringtrue
fieldsschema to createFieldstrue

Fields(object)

ParameterDescriptiontyperequired
nameField nameStringtrue
descriptionField descriptionStringtrue
data_typeField typeDataTypetrue
type_paramsVector Field paramObjectfalse
autoIDIs auto generated IDBoolfalse
is_primary_keyIs primary keyBoolfalse

DataType

ValueDescription
0none
1Bool
2Int8
3Int16
4Int32
5Int64
10Float
11Double
20String
100BinaryVector
101FloatVector

Example

new milvusClient(MILUVS_ADDRESS).collectionManager.createCollection({
  collection_name: 'my_collection',
  fields: [
    {
      name: "vector_01",
      description: "vector field",
      data_type: DataType.FloatVect,
      type_params: {
        dim: "8"
      }
    },
    {
      name: "age",
      data_type: DataType.Int64,
      autoID: true,
      is_primary_key: true,
      description: "",
    },
  ],
});

Return

// create collection return