-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Milvus-doc-bot
authored and
Milvus-doc-bot
committed
Nov 13, 2024
1 parent
98c4062
commit 9989db8
Showing
4 changed files
with
7 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"codeList":["from pymilvus import FieldSchema\nid_field = FieldSchema(name=\"id\", dtype=DataType.INT64, is_primary=True, description=\"primary id\")\nage_field = FieldSchema(name=\"age\", dtype=DataType.INT64, description=\"age\")\nembedding_field = FieldSchema(name=\"embedding\", dtype=DataType.FLOAT_VECTOR, dim=128, description=\"vector\")\n\n# The following creates a field and use it as the partition key\nposition_field = FieldSchema(name=\"position\", dtype=DataType.VARCHAR, max_length=256, is_partition_key=True)\n","from pymilvus import FieldSchema\n\nfields = [\n FieldSchema(name=\"id\", dtype=DataType.INT64, is_primary=True),\n # configure default value `25` for field `age`\n FieldSchema(name=\"age\", dtype=DataType.INT64, default_value=25, description=\"age\"),\n embedding_field = FieldSchema(name=\"embedding\", dtype=DataType.FLOAT_VECTOR, dim=128, description=\"vector\")\n]\n","from pymilvus import FieldSchema, CollectionSchema\nid_field = FieldSchema(name=\"id\", dtype=DataType.INT64, is_primary=True, description=\"primary id\")\nage_field = FieldSchema(name=\"age\", dtype=DataType.INT64, description=\"age\")\nembedding_field = FieldSchema(name=\"embedding\", dtype=DataType.FLOAT_VECTOR, dim=128, description=\"vector\")\n\n# Enable partition key on a field if you need to implement multi-tenancy based on the partition-key field\nposition_field = FieldSchema(name=\"position\", dtype=DataType.VARCHAR, max_length=256, is_partition_key=True)\n\n# Set enable_dynamic_field to True if you need to use dynamic fields. \nschema = CollectionSchema(fields=[id_field, age_field, embedding_field], auto_id=False, enable_dynamic_field=True, description=\"desc of a collection\")\n","from pymilvus import Collection\ncollection_name1 = \"tutorial_1\"\ncollection1 = Collection(name=collection_name1, schema=schema, using='default', shards_num=2)\n","import pandas as pd\ndf = pd.DataFrame({\n \"id\": [i for i in range(nb)],\n \"age\": [random.randint(20, 40) for i in range(nb)],\n \"embedding\": [[random.random() for _ in range(dim)] for _ in range(nb)],\n \"position\": \"test_pos\"\n})\n\ncollection, ins_res = Collection.construct_from_dataframe(\n 'my_collection',\n df,\n primary_field='id',\n auto_id=False\n )\n"],"headingContent":"Manage Schema","anchorList":[{"label":"Manage Schema","href":"Manage-Schema","type":1,"isActive":false},{"label":"Field schema","href":"Field-schema","type":2,"isActive":false},{"label":"Collection schema","href":"Collection-schema","type":2,"isActive":false},{"label":"What's next","href":"Whats-next","type":2,"isActive":false}]} | ||
{"codeList":["from pymilvus import FieldSchema\nid_field = FieldSchema(name=\"id\", dtype=DataType.INT64, is_primary=True, description=\"primary id\")\nage_field = FieldSchema(name=\"age\", dtype=DataType.INT64, description=\"age\")\nembedding_field = FieldSchema(name=\"embedding\", dtype=DataType.FLOAT_VECTOR, dim=128, description=\"vector\")\n\n# The following creates a field and use it as the partition key\nposition_field = FieldSchema(name=\"position\", dtype=DataType.VARCHAR, max_length=256, is_partition_key=True)\n","from pymilvus import FieldSchema\n\nfields = [\n FieldSchema(name=\"id\", dtype=DataType.INT64, is_primary=True),\n # configure default value `25` for field `age`\n FieldSchema(name=\"age\", dtype=DataType.INT64, default_value=25, description=\"age\"),\n embedding_field = FieldSchema(name=\"embedding\", dtype=DataType.FLOAT_VECTOR, dim=128, description=\"vector\")\n]\n","from pymilvus import FieldSchema, CollectionSchema\nid_field = FieldSchema(name=\"id\", dtype=DataType.INT64, is_primary=True, description=\"primary id\")\nage_field = FieldSchema(name=\"age\", dtype=DataType.INT64, description=\"age\")\nembedding_field = FieldSchema(name=\"embedding\", dtype=DataType.FLOAT_VECTOR, dim=128, description=\"vector\")\n\n# Enable partition key on a field if you need to implement multi-tenancy based on the partition-key field\nposition_field = FieldSchema(name=\"position\", dtype=DataType.VARCHAR, max_length=256, is_partition_key=True)\n\n# Set enable_dynamic_field to True if you need to use dynamic fields. \nschema = CollectionSchema(fields=[id_field, age_field, embedding_field], auto_id=False, enable_dynamic_field=True, description=\"desc of a collection\")\n","from pymilvus import Collection,connections\nconn = connections.connect(host=\"127.0.0.1\", port=19530)\ncollection_name1 = \"tutorial_1\"\ncollection1 = Collection(name=collection_name1, schema=schema, using='default', shards_num=2)\n","import pandas as pd\ndf = pd.DataFrame({\n \"id\": [i for i in range(nb)],\n \"age\": [random.randint(20, 40) for i in range(nb)],\n \"embedding\": [[random.random() for _ in range(dim)] for _ in range(nb)],\n \"position\": \"test_pos\"\n})\n\ncollection, ins_res = Collection.construct_from_dataframe(\n 'my_collection',\n df,\n primary_field='id',\n auto_id=False\n )\n"],"headingContent":"Manage Schema","anchorList":[{"label":"Manage Schema","href":"Manage-Schema","type":1,"isActive":false},{"label":"Field schema","href":"Field-schema","type":2,"isActive":false},{"label":"Collection schema","href":"Collection-schema","type":2,"isActive":false},{"label":"What's next","href":"Whats-next","type":2,"isActive":false}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters