{"id":18248024,"url":"https://github.com/hourout/milvus_kernel","last_synced_at":"2025-07-05T14:33:25.534Z","repository":{"id":57441663,"uuid":"336937367","full_name":"Hourout/milvus_kernel","owner":"Hourout","description":"Milvus Kernel for Jupyter","archived":false,"fork":false,"pushed_at":"2021-02-22T06:09:21.000Z","size":430,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-16T03:01:34.913Z","etag":null,"topics":["jupyter-kernel","milvus","milvus-kernel"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hourout.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-08T02:19:01.000Z","updated_at":"2021-02-22T06:09:23.000Z","dependencies_parsed_at":"2022-09-06T02:01:37.101Z","dependency_job_id":null,"html_url":"https://github.com/Hourout/milvus_kernel","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Hourout/milvus_kernel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hourout%2Fmilvus_kernel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hourout%2Fmilvus_kernel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hourout%2Fmilvus_kernel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hourout%2Fmilvus_kernel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hourout","download_url":"https://codeload.github.com/Hourout/milvus_kernel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hourout%2Fmilvus_kernel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263755676,"owners_count":23506432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jupyter-kernel","milvus","milvus-kernel"],"created_at":"2024-11-05T09:35:17.934Z","updated_at":"2025-07-05T14:33:25.508Z","avatar_url":"https://github.com/Hourout.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# milvus_kernel\n\nMilvus Kernel for Jupyter\n\n\n![PyPI version](https://img.shields.io/pypi/pyversions/milvus_kernel.svg)\n![Github license](https://img.shields.io/github/license/Hourout/milvus_kernel.svg)\n[![PyPI](https://img.shields.io/pypi/v/milvus_kernel.svg)](https://pypi.python.org/pypi/milvus_kernel)\n![PyPI format](https://img.shields.io/pypi/format/milvus_kernel.svg)\n![contributors](https://img.shields.io/github/contributors/Hourout/milvus_kernel)\n![downloads](https://img.shields.io/pypi/dm/milvus_kernel.svg)\n\n[中文介绍](document/chinese.md)\n\n## Installation\n\n#### step1:\n```\npip install milvus_kernel\n```\n\nTo get the newest one from this repo (note that we are in the alpha stage, so there may be frequent updates), type:\n\n```\npip install git+git://github.com/Hourout/milvus_kernel.git\n```\n\n#### step2:\nAdd kernel to your jupyter:\n\n```\npython3 -m milvus_kernel.install\n```\n\nALL DONE! 🎉🎉🎉\n\n## Uninstall\n\n#### step1:\n\nView and remove milvus kernel\n```\njupyter kernelspec list\njupyter kernelspec remove milvus\n```\n\n#### step2:\nuninstall milvus kernel:\n\n```\npip uninstall milvus-kernel\n```\n\nALL DONE! 🎉🎉🎉\n\n\n## Using\n\n```\njupyter notebook\n```\n\u003cimg src=\"image/milvus1.png\" width = \"700\" height = \"300\" /\u003e\n\n### step1: you should set milvus host and port\n\n### step2: write your milvus code\n\n![](image/milvus2.png)\n\n\n## Basic operations\n\n## Connect to the Milvus server\n\n1. Create a client to Milvus server by using the following methods:\n\n   ```sql\n   milvus://127.0.0.1:19530\n   ```\n\n## Create/Drop collections\n\n### Create a collection\n\nCreate collection `test01` with dimension size as 128, size of the data file for Milvus to automatically create indexes as 1024, and metric type as Euclidean distance (L2).\n\n   ```sql\n   create table test01 where dimension=128 and index_file_size=1024 and metric_type='L2'\n   ```\n\n### Drop a collection\n\n```sql\ndrop table test01\n```\n\n## Create/Drop partitions in a collection\n\n### Create a partition\n\nYou can split collections into partitions by partition tags for improved search performance. Each partition is also a collection.\n\n   ```sql\n   create partition test01 where partition_tag='tag01'\n   ```\n\nverify whether the partition is created.\n\n```sql\nlist partitions test01\n```\n\n### Drop a partition\n\n```sql\ndrop partition test01 where partition_tag='tag01'\n```\n\n## Create/Drop indexes in a collection\n\n### Create an index\n\n\u003e Note: In production, it is recommended to create indexes before inserting vectors into the collection. Index is automatically built when vectors are being imported. However, you need to create the same index again after the vector insertion process is completed because some data files may not meet the `index_file_size` and index will not be automatically built for these data files.\n\nCreate an index for the collection. The following command uses `IVF_FLAT` index type as an example\n\n   ```sql\n   create index test01 where index_type='FLAT' and nlist=4096\n   ```\n\n### Drop an index\n\n```sql\ndrop index test01\n```\n\n## Insert/Delete vectors in collections/partitions\n\n### Insert vectors in a collection\n\n1. Insert a vector. If you do not specify vector ids, Milvus automatically generates IDs for the vectors.\n\n   ```sql\n   insert 2,3,5 from test01\n   ```\n\n   Alternatively, you can also provide user-defined vector ids:\n\n   ```sql\n   insert 2,3,5 from test01 where by id=0\n   ```\n\n### Insert vectors in a partition\n\n```sql\ninsert 2,3,5 from test01 where partition_tag='tag01' by id=0\n```\n\nTo verify the vectors you have inserted. Assume you have vector with the following ID.\n\n```sql\nselect test01 by id=1,2,3\n```\n\n### Delete vectors by ID\n\nYou can delete these vectors by:\n\n```sql\ndelete test01 by id=1\n```\n\n## Flush data in one or multiple collections to disk\n\nWhen performing operations related to data changes, you can flush the data from memory to disk to avoid possible data loss. Milvus also supports automatic flushing, which runs at a fixed interval to flush the data in all collections to disk. You can use the [Milvus server configuration file](https://milvus.io/docs/reference/milvus_config.md) to set the interval.\n\n```sql\nflush test01, test02\n```\n\n## Compact all segments in a collection\n\nA segment is a data file that Milvus automatically creates by merging inserted vector data. A collection can contain multiple segments. If some vectors are deleted from a segment, the space taken by the deleted vectors cannot be released automatically. You can compact segments in a collection to release space.\n\n```sql\ncompact test01\n```\n\n## Search vectors in collections/partitions\n\n\n### Search vectors in a collection\n\n```sql\nselect 2, 3, 5 from test01 where top_k=1 and partition_tags='tag01' and nprobe=16\n```\n\n\n## Quote \nkernel logo\n\n\u003cimg src=\"https://imgconvert.csdnimg.cn/aHR0cHM6Ly9tbWJpei5xcGljLmNuL21tYml6X3BuZy9NcWdBOFlsZ2VoNHozS05uUHVuaWNVNTBnTTROVlE0U0RJVkNHcks4enFoc1FPRUdtMGtjZFBoamxiZ01zTE5wM0NUNkp5Z1M0aWNlazZHY2Q2SlhTd05BLzY0MA?x-oss-process=image/format,png\" width = \"32\" height = \"32\" /\u003e\n\n- https://blog.csdn.net/weixin_44839084/article/details/108070675\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhourout%2Fmilvus_kernel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhourout%2Fmilvus_kernel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhourout%2Fmilvus_kernel/lists"}