diff --git a/localization/v2.4.x/site/en/userGuide/manage-indexes/index-scalar-fields.json b/localization/v2.4.x/site/en/userGuide/manage-indexes/index-scalar-fields.json index 8717641f9..aab7d3f0a 100644 --- a/localization/v2.4.x/site/en/userGuide/manage-indexes/index-scalar-fields.json +++ b/localization/v2.4.x/site/en/userGuide/manage-indexes/index-scalar-fields.json @@ -1 +1 @@ -{"codeList":["# Auto indexing\nclient = MilvusClient(\n uri=\"http://localhost:19530\"\n)\n\nindex_params = client.create_index_params() # Prepare an empty IndexParams object, without having to specify any index parameters\n\nindex_params.add_index(\n field_name=\"scalar_1\", # Name of the scalar field to be indexed\n index_type=\"\", # Type of index to be created. For auto indexing, leave it empty or omit this parameter.\n index_name=\"default_index\" # Name of the index to be created\n)\n\nclient.create_index(\n collection_name=\"test_scalar_index\", # Specify the collection name\n index_params=index_params\n)\n","import io.milvus.v2.common.IndexParam;\nimport io.milvus.v2.service.index.request.CreateIndexReq;\n\nIndexParam indexParamForScalarField = IndexParam.builder()\n .fieldName(\"scalar_1\") // Name of the scalar field to be indexed\n .indexName(\"default_index\") // Name of the index to be created\n .indexType(\"\") // Type of index to be created. For auto indexing, leave it empty or omit this parameter.\n .build();\n\nList indexParams = new ArrayList<>();\nindexParams.add(indexParamForVectorField);\n\nCreateIndexReq createIndexReq = CreateIndexReq.builder()\n .collectionName(\"test_scalar_index\") // Specify the collection name\n .indexParams(indexParams)\n .build();\n\nclient.createIndex(createIndexReq);\n","await client.createIndex({\n collection_name: \"test_scalar_index\", // Specify the collection name\n field_name: \"scalar_1\", // Name of the scalar field to be indexed\n index_name: \"default_index\", // Name of the index to be created\n index_type: \"\" // Type of index to be created. For auto indexing, leave it empty or omit this parameter.\n})\n","index_params = client.create_index_params() # Prepare an IndexParams object\n\nindex_params.add_index(\n field_name=\"scalar_2\", # Name of the scalar field to be indexed\n index_type=\"INVERTED\", # Type of index to be created\n index_name=\"inverted_index\" # Name of the index to be created\n)\n\nclient.create_index(\n collection_name=\"test_scalar_index\", # Specify the collection name\n index_params=index_params\n)\n","import io.milvus.v2.common.IndexParam;\nimport io.milvus.v2.service.index.request.CreateIndexReq;\n\nIndexParam indexParamForScalarField = IndexParam.builder()\n .fieldName(\"scalar_1\") // Name of the scalar field to be indexed\n .indexName(\"inverted_index\") // Name of the index to be created\n .indexType(\"INVERTED\") // Type of index to be created\n .build();\n\nList indexParams = new ArrayList<>();\nindexParams.add(indexParamForVectorField);\n\nCreateIndexReq createIndexReq = CreateIndexReq.builder()\n .collectionName(\"test_scalar_index\") // Specify the collection name\n .indexParams(indexParams)\n .build();\n\nclient.createIndex(createIndexReq);\n","await client.createIndex({\n collection_name: \"test_scalar_index\", // Specify the collection name\n field_name: \"scalar_1\", // Name of the scalar field to be indexed\n index_name: \"inverted_index\", // Name of the index to be created\n index_type: \"INVERTED\" // Type of index to be created\n})\n","client.list_indexes(\n collection_name=\"test_scalar_index\" # Specify the collection name\n)\n\n# Output:\n# ['default_index','inverted_index']\n","import java.util.List;\nimport io.milvus.v2.service.index.request.ListIndexesReq;\n\nListIndexesReq listIndexesReq = ListIndexesReq.builder()\n .collectionName(\"test_scalar_index\") // Specify the collection name\n .build();\n\nList indexNames = client.listIndexes(listIndexesReq);\n\nSystem.out.println(indexNames);\n\n// Output:\n// [\n// \"default_index\",\n// \"inverted_index\"\n// ]\n","res = await client.listIndexes({\n collection_name: 'test_scalar_index'\n})\n\nconsole.log(res.indexes)\n\n// Output:\n// [\n// \"default_index\",\n// \"inverted_index\"\n// ] \n"],"headingContent":"Index Scalar Fields","anchorList":[{"label":"Index Scalar Fields","href":"Index-Scalar-Fields","type":1,"isActive":false},{"label":"Types of scalar indexing","href":"Types-of-scalar-indexing","type":2,"isActive":false},{"label":"Auto indexing","href":"Auto-indexing","type":2,"isActive":false},{"label":"Custom indexing","href":"Custom-indexing","type":2,"isActive":false},{"label":"Verifying the result","href":"Verifying-the-result","type":2,"isActive":false},{"label":"Limits","href":"Limits","type":2,"isActive":false}]} \ No newline at end of file +{"codeList":["# Auto indexing\nclient = MilvusClient(\n uri=\"http://localhost:19530\"\n)\n\nindex_params = MilvusClient.prepare_index_params() # Prepare an empty IndexParams object, without having to specify any index parameters\n\nindex_params.add_index(\n field_name=\"scalar_1\", # Name of the scalar field to be indexed\n index_type=\"\", # Type of index to be created. For auto indexing, leave it empty or omit this parameter.\n index_name=\"default_index\" # Name of the index to be created\n)\n\nclient.create_index(\n collection_name=\"test_scalar_index\", # Specify the collection name\n index_params=index_params\n)\n","import io.milvus.v2.common.IndexParam;\nimport io.milvus.v2.service.index.request.CreateIndexReq;\n\nIndexParam indexParamForScalarField = IndexParam.builder()\n .fieldName(\"scalar_1\") // Name of the scalar field to be indexed\n .indexName(\"default_index\") // Name of the index to be created\n .indexType(\"\") // Type of index to be created. For auto indexing, leave it empty or omit this parameter.\n .build();\n\nList indexParams = new ArrayList<>();\nindexParams.add(indexParamForVectorField);\n\nCreateIndexReq createIndexReq = CreateIndexReq.builder()\n .collectionName(\"test_scalar_index\") // Specify the collection name\n .indexParams(indexParams)\n .build();\n\nclient.createIndex(createIndexReq);\n","await client.createIndex({\n collection_name: \"test_scalar_index\", // Specify the collection name\n field_name: \"scalar_1\", // Name of the scalar field to be indexed\n index_name: \"default_index\", // Name of the index to be created\n index_type: \"\" // Type of index to be created. For auto indexing, leave it empty or omit this parameter.\n})\n","index_params = MilvusClient.prepare_index_params() # Prepare an IndexParams object\n\nindex_params.add_index(\n field_name=\"scalar_2\", # Name of the scalar field to be indexed\n index_type=\"INVERTED\", # Type of index to be created\n index_name=\"inverted_index\" # Name of the index to be created\n)\n\nclient.create_index(\n collection_name=\"test_scalar_index\", # Specify the collection name\n index_params=index_params\n)\n","import io.milvus.v2.common.IndexParam;\nimport io.milvus.v2.service.index.request.CreateIndexReq;\n\nIndexParam indexParamForScalarField = IndexParam.builder()\n .fieldName(\"scalar_1\") // Name of the scalar field to be indexed\n .indexName(\"inverted_index\") // Name of the index to be created\n .indexType(\"INVERTED\") // Type of index to be created\n .build();\n\nList indexParams = new ArrayList<>();\nindexParams.add(indexParamForVectorField);\n\nCreateIndexReq createIndexReq = CreateIndexReq.builder()\n .collectionName(\"test_scalar_index\") // Specify the collection name\n .indexParams(indexParams)\n .build();\n\nclient.createIndex(createIndexReq);\n","await client.createIndex({\n collection_name: \"test_scalar_index\", // Specify the collection name\n field_name: \"scalar_1\", // Name of the scalar field to be indexed\n index_name: \"inverted_index\", // Name of the index to be created\n index_type: \"INVERTED\" // Type of index to be created\n})\n","client.list_indexes(\n collection_name=\"test_scalar_index\" # Specify the collection name\n)\n\n# Output:\n# ['default_index','inverted_index']\n","import java.util.List;\nimport io.milvus.v2.service.index.request.ListIndexesReq;\n\nListIndexesReq listIndexesReq = ListIndexesReq.builder()\n .collectionName(\"test_scalar_index\") // Specify the collection name\n .build();\n\nList indexNames = client.listIndexes(listIndexesReq);\n\nSystem.out.println(indexNames);\n\n// Output:\n// [\n// \"default_index\",\n// \"inverted_index\"\n// ]\n","res = await client.listIndexes({\n collection_name: 'test_scalar_index'\n})\n\nconsole.log(res.indexes)\n\n// Output:\n// [\n// \"default_index\",\n// \"inverted_index\"\n// ] \n"],"headingContent":"Index Scalar Fields","anchorList":[{"label":"Index Scalar Fields","href":"Index-Scalar-Fields","type":1,"isActive":false},{"label":"Types of scalar indexing","href":"Types-of-scalar-indexing","type":2,"isActive":false},{"label":"Auto indexing","href":"Auto-indexing","type":2,"isActive":false},{"label":"Custom indexing","href":"Custom-indexing","type":2,"isActive":false},{"label":"Verifying the result","href":"Verifying-the-result","type":2,"isActive":false},{"label":"Limits","href":"Limits","type":2,"isActive":false}]} \ No newline at end of file diff --git a/localization/v2.4.x/site/en/userGuide/manage-indexes/index-scalar-fields.md b/localization/v2.4.x/site/en/userGuide/manage-indexes/index-scalar-fields.md index 887c3b7d7..a44c9a68a 100644 --- a/localization/v2.4.x/site/en/userGuide/manage-indexes/index-scalar-fields.md +++ b/localization/v2.4.x/site/en/userGuide/manage-indexes/index-scalar-fields.md @@ -76,7 +76,7 @@ client = MilvusClient( uri="http://localhost:19530" ) -index_params = client.create_index_params() # Prepare an empty IndexParams object, without having to specify any index parameters +index_params = MilvusClient.prepare_index_params() # Prepare an empty IndexParams object, without having to specify any index parameters index_params.add_index( field_name="scalar_1", # Name of the scalar field to be indexed @@ -145,7 +145,7 @@ client.createIndex(createIndexReq); Java Node.js -
index_params = client.create_index_params() #  Prepare an IndexParams object
+
index_params = MilvusClient.prepare_index_params() #  Prepare an IndexParams object
 
 index_params.add_index(
     field_name="scalar_2", # Name of the scalar field to be indexed
@@ -187,7 +187,7 @@ client.createIndex(createIndexReq);
 

Methods and Parameters

    -
  • create_index_params()

    +
  • prepare_index_params()

    Prepares an IndexParams object.

  • add_index()

    Adds index configurations to the IndexParams object.

    diff --git a/localization/v2.4.x/site/en/userGuide/manage-partitions.json b/localization/v2.4.x/site/en/userGuide/manage-partitions.json index c5c227c9e..9fce83267 100644 --- a/localization/v2.4.x/site/en/userGuide/manage-partitions.json +++ b/localization/v2.4.x/site/en/userGuide/manage-partitions.json @@ -1 +1 @@ -{"codeList":["from pymilvus import MilvusClient, DataType\n\n# 1. Set up a Milvus client\nclient = MilvusClient(\n uri=\"http://localhost:19530\"\n)\n\n# 2. Create a collection\nclient.create_collection(\n collection_name=\"quick_setup\",\n dimension=5,\n)\n\n","import io.milvus.v2.client.ConnectConfig;\nimport io.milvus.v2.client.MilvusClientV2;\nimport io.milvus.v2.service.collection.request.CreateCollectionReq;\n\nString CLUSTER_ENDPOINT = \"http://localhost:19530\";\n\n// 1. Connect to Milvus server\nConnectConfig connectConfig = ConnectConfig.builder()\n .uri(CLUSTER_ENDPOINT)\n .build();\n\nMilvusClientV2 client = new MilvusClientV2(connectConfig);\n\n// 2. Create a collection in quick setup mode\nCreateCollectionReq quickSetupReq = CreateCollectionReq.builder()\n .collectionName(\"quick_setup\")\n .dimension(5)\n .build();\n\nclient.createCollection(quickSetupReq);\n","const address = \"http://localhost:19530\"\n\n// 1. Set up a Milvus Client\nclient = new MilvusClient({address});\n\n// 2. Create a collection in quick setup mode\nawait client.createCollection({\n collection_name: \"quick_setup\",\n dimension: 5,\n}); \n","# 3. List partitions\nres = client.list_partitions(collection_name=\"quick_setup\")\nprint(res)\n\n# Output\n#\n# [\"_default\"]\n","import io.milvus.v2.service.partition.request.ListPartitionsReq;\n\n// 3. List all partitions in the collection\nListPartitionsReq listPartitionsReq = ListPartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .build();\n\nList partitionNames = client.listPartitions(listPartitionsReq);\n\nSystem.out.println(partitionNames);\n\n// Output:\n// [\"_default\"]\n","// 3. List partitions\nres = await client.listPartitions({\n collection_name: \"quick_setup\"\n})\n\nconsole.log(res.partition_names)\n\n// Output\n// \n// [ '_default' ]\n// \n","# 4. Create more partitions\nclient.create_partition(\n collection_name=\"quick_setup\",\n partition_name=\"partitionA\"\n)\n\nclient.create_partition(\n collection_name=\"quick_setup\",\n partition_name=\"partitionB\"\n)\n\nres = client.list_partitions(collection_name=\"quick_setup\")\nprint(res)\n\n# Output\n#\n# [\"_default\", \"partitionA\", \"partitionB\"]\n","import io.milvus.v2.service.partition.request.CreatePartitionReq;\n\n// 4. Create more partitions\nCreatePartitionReq createPartitionReq = CreatePartitionReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionA\")\n .build();\n\nclient.createPartition(createPartitionReq);\n\ncreatePartitionReq = CreatePartitionReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionB\")\n .build();\n\nclient.createPartition(createPartitionReq);\n\nlistPartitionsReq = ListPartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .build();\n\npartitionNames = client.listPartitions(listPartitionsReq);\n\nSystem.out.println(partitionNames);\n\n// Output:\n// [\n// \"_default\",\n// \"partitionA\",\n// \"partitionB\"\n// ]\n","// 4. Create more partitions\nawait client.createPartition({\n collection_name: \"quick_setup\",\n partition_name: \"partitionA\"\n})\n\nawait client.createPartition({\n collection_name: \"quick_setup\",\n partition_name: \"partitionB\"\n})\n\nres = await client.listPartitions({\n collection_name: \"quick_setup\"\n})\n\nconsole.log(res.partition_names)\n\n// Output\n// \n// [ '_default', 'partitionA', 'partitionB' ]\n// \n","# 5. Check whether a partition exists\nres = client.has_partition(\n collection_name=\"quick_setup\",\n partition_name=\"partitionA\"\n)\nprint(res)\n\n# Output\n#\n# True\n\nres = client.has_partition(\n collection_name=\"quick_setup\",\n partition_name=\"partitionC\"\n)\nprint(res)\n\n# Output\n#\n# False\n","import io.milvus.v2.service.partition.request.HasPartitionReq;\n\n// 5. Check whether a partition exists\nHasPartitionReq hasPartitionReq = HasPartitionReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionA\")\n .build();\n\nboolean exists = client.hasPartition(hasPartitionReq);\n\nSystem.out.println(exists);\n\n// Output:\n// true\n\nhasPartitionReq = HasPartitionReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionC\")\n .build();\n\nexists = client.hasPartition(hasPartitionReq);\n\nSystem.out.println(exists);\n\n// Output:\n// false\n","// 5. Check whether a partition exists\nres = await client.hasPartition({\n collection_name: \"quick_setup\",\n partition_name: \"partitionA\"\n})\n\nconsole.log(res.value)\n\n// Output\n// \n// true\n// \n\nres = await client.hasPartition({\n collection_name: \"quick_setup\",\n partition_name: \"partitionC\"\n})\n\nconsole.log(res.value)\n\n// Output\n// \n// false\n// \n","# Release the collection\nclient.release_collection(collection_name=\"quick_setup\")\n\n# Check the load status\nres = client.get_load_state(collection_name=\"quick_setup\")\nprint(res)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n\nres = client.get_load_state(\n collection_name=\"quick_setup\", \n partition_name=\"partitionA\"\n)\n\nprint(res)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n\nres = client.get_load_state(\n collection_name=\"quick_setup\", \n partition_name=\"partitionB\"\n)\n\nprint(res)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n\n","import io.milvus.v2.service.collection.request.GetLoadStateReq;\nimport io.milvus.v2.service.collection.request.ReleaseCollectionReq;\nimport io.milvus.v2.service.partition.request.LoadPartitionsReq;\nimport io.milvus.v2.service.partition.request.ReleasePartitionsReq;\n\n// 6. Load a partition independantly\n// 6.1 Release the collection\nReleaseCollectionReq releaseCollectionReq = ReleaseCollectionReq.builder()\n .collectionName(\"quick_setup\")\n .build();\n\nclient.releaseCollection(releaseCollectionReq);\n\n// 6.2 Load partitionA\nLoadPartitionsReq loadPartitionsReq = LoadPartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .partitionNames(List.of(\"partitionA\"))\n .build();\n\nclient.loadPartitions(loadPartitionsReq);\n\nThread.sleep(3000);\n\n// 6.3 Check the load status of the collection and its partitions\nGetLoadStateReq getLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .build();\n\nboolean state = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// true\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionA\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// true\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionB\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// false\n","// 6. Load a partition indenpendantly\nawait client.releaseCollection({\n collection_name: \"quick_setup\"\n})\n\nres = await client.getLoadState({\n collection_name: \"quick_setup\"\n})\n\nconsole.log(res.state)\n\n// Output\n// \n// LoadStateNotLoad\n// \n\nawait client.loadPartitions({\n collection_name: \"quick_setup\",\n partition_names: [\"partitionA\"]\n})\n\nawait sleep(3000)\n\nres = await client.getLoadState({\n collection_name: \"quick_setup\"\n})\n\nconsole.log(res.state)\n\n// Output\n// \n// LoadStateLoaded\n// \n\nres = await client.getLoadState({\n collection_name: \"quick_setup\",\n partition_name: \"partitionA\"\n})\n\nconsole.log(res.state)\n\n// Output\n// \n// LoadStateLoaded\n// \n\nres = await client.getLoadState({\n collection_name: \"quick_setup\",\n partition_name: \"partitionB\"\n})\n\nconsole.log(res.state)\n\n// Output\n// \n// LoadStateLoaded\n// \n","client.load_partitions(\n collection_name=\"quick_setup\",\n partition_names=[\"partitionA\"]\n)\n\nres = client.get_load_state(collection_name=\"quick_setup\")\nprint(res)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n","LoadPartitionsReq loadPartitionsReq = LoadPartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .partitionNames(List.of(\"partitionA\"))\n .build();\n\nclient.loadPartitions(loadPartitionsReq);\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionA\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// true\n","await client.loadPartitions({\n collection_name: \"quick_setup\",\n partition_names: [\"partitionA\"]\n})\n\nres = await client.getLoadState({\n collection_name: \"quick_setup\",\n partition_name: \"partitionA\"\n})\n\nconsole.log(res.state)\n\n// Output\n// \n// LoadStateLoaded\n//\n","client.load_partitions(\n collection_name=\"quick_setup\",\n partition_names=[\"partitionA\", \"partitionB\"]\n)\n\nres = client.get_load_status(\n collection_name=\"quick_setup\",\n partition_name=\"partitionA\"\n)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n\nres = client.get_load_status(\n collection_name=\"quick_setup\",\n partition_name=\"partitionB\"\n)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n","LoadPartitionsReq loadPartitionsReq = LoadPartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .partitionNames(List.of(\"partitionA\", \"partitionB\"))\n .build();\n\nclient.loadPartitions(loadPartitionsReq);\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionA\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// true\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionB\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// true\n","await client.loadPartitions({\n collection_name: \"quick_setup\",\n partition_names: [\"partitionA\", \"partitionB\"]\n})\n\nres = await client.getLoadState({\n collection_name: \"quick_setup\",\n partition_name: \"partitionA\"\n})\n\nconsole.log(res)\n\n// Output\n// \n// LoadStateLoaded\n// \n\nres = await client.getLoadState({\n collection_name: \"quick_setup\",\n partition_name: \"partitionB\"\n})\n\nconsole.log(res)\n\n// Output\n// \n// LoadStateLoaded\n// \n","client.load_partitions(\n collection_name=\"quick_setup\",\n partition_names=[\"partitionA\"],\n load_fields=[\"id\", \"vector\"],\n skip_load_dynamic_field=True\n)\n","# 7. Release a partition\nclient.release_partitions(\n collection_name=\"quick_setup\",\n partition_names=[\"partitionA\"]\n)\n\nres = client.get_load_state(\n collection_name=\"quick_setup\", \n partition_name=\"partitionA\"\n)\n\nprint(res)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n\n","import io.milvus.v2.service.partition.request.ReleasePartitionsReq;\n\n// 7. Release a partition\nReleasePartitionsReq releasePartitionsReq = ReleasePartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .partitionNames(List.of(\"partitionA\"))\n .build();\n\nclient.releasePartitions(releasePartitionsReq);\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionA\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// false\n","// 7. Release a partition\nawait client.releasePartitions({\n collection_name: \"quick_setup\",\n partition_names: [\"partitionA\"]\n})\n\nres = await client.getLoadState({\n collection_name: \"quick_setup\"\n})\n\nconsole.log(res.state)\n\n// Output\n// \n// LoadStateNotLoad\n// \n","client.release_partitions(\n collection_name=\"quick_setup\",\n partition_names=[\"_default\", \"partitionA\", \"partitionB\"]\n)\n\nres = client.get_load_status(\n collection_name=\"quick_setup\",\n)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n","# 8. Drop a partition\nclient.drop_partition(\n collection_name=\"quick_setup\",\n partition_name=\"partitionB\"\n)\n\nres = client.list_partitions(collection_name=\"quick_setup\")\nprint(res)\n\n# Output\n#\n# [\"_default\", \"partitionA\"]\n","import io.milvus.v2.service.partition.request.ReleasePartitionsReq;\n\nReleasePartitionsReq releasePartitionsReq = ReleasePartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .partitionNames(List.of(\"_default\", \"partitionA\", \"partitionB\"))\n .build();\n\nclient.releasePartitions(releasePartitionsReq);\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// false\n","\nawait client.releasePartitions({\n collection_name: \"quick_setup\",\n partition_names: [\"_default\", \"partitionA\", \"partitionB\"]\n})\n\nres = await client.getLoadState({\n collection_name: \"quick_setup\"\n})\n\nconsole.log(res)\n\n// Output\n// \n// {\n// status: {\n// error_code: 'Success',\n// reason: '',\n// code: 0,\n// retriable: false,\n// detail: ''\n// },\n// state: 'LoadStateNotLoad'\n// }\n// \n"],"headingContent":"Manage Partitions","anchorList":[{"label":"Manage Partitions","href":"Manage-Partitions","type":1,"isActive":false},{"label":"Overview","href":"Overview","type":2,"isActive":false},{"label":"Preparations","href":"Preparations","type":2,"isActive":false},{"label":"List Partitions","href":"List-Partitions","type":2,"isActive":false},{"label":"Create Partitions","href":"Create-Partitions","type":2,"isActive":false},{"label":"Check for a Specific Partition","href":"Check-for-a-Specific-Partition","type":2,"isActive":false},{"label":"Load & Release Partitions","href":"Load--Release-Partitions","type":2,"isActive":false},{"label":"Drop Partitions","href":"Drop-Partitions","type":2,"isActive":false},{"label":"FAQ","href":"FAQ","type":2,"isActive":false}]} \ No newline at end of file +{"codeList":["from pymilvus import MilvusClient, DataType\n\n# 1. Set up a Milvus client\nclient = MilvusClient(\n uri=\"http://localhost:19530\"\n)\n\n# 2. Create a collection\nclient.create_collection(\n collection_name=\"quick_setup\",\n dimension=5,\n)\n\n","import io.milvus.v2.client.ConnectConfig;\nimport io.milvus.v2.client.MilvusClientV2;\nimport io.milvus.v2.service.collection.request.CreateCollectionReq;\n\nString CLUSTER_ENDPOINT = \"http://localhost:19530\";\n\n// 1. Connect to Milvus server\nConnectConfig connectConfig = ConnectConfig.builder()\n .uri(CLUSTER_ENDPOINT)\n .build();\n\nMilvusClientV2 client = new MilvusClientV2(connectConfig);\n\n// 2. Create a collection in quick setup mode\nCreateCollectionReq quickSetupReq = CreateCollectionReq.builder()\n .collectionName(\"quick_setup\")\n .dimension(5)\n .build();\n\nclient.createCollection(quickSetupReq);\n","const address = \"http://localhost:19530\"\n\n// 1. Set up a Milvus Client\nclient = new MilvusClient({address});\n\n// 2. Create a collection in quick setup mode\nawait client.createCollection({\n collection_name: \"quick_setup\",\n dimension: 5,\n}); \n","# 3. List partitions\nres = client.list_partitions(collection_name=\"quick_setup\")\nprint(res)\n\n# Output\n#\n# [\"_default\"]\n","import io.milvus.v2.service.partition.request.ListPartitionsReq;\n\n// 3. List all partitions in the collection\nListPartitionsReq listPartitionsReq = ListPartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .build();\n\nList partitionNames = client.listPartitions(listPartitionsReq);\n\nSystem.out.println(partitionNames);\n\n// Output:\n// [\"_default\"]\n","// 3. List partitions\nres = await client.listPartitions({\n collection_name: \"quick_setup\"\n})\n\nconsole.log(res.partition_names)\n\n// Output\n// \n// [ '_default' ]\n// \n","# 4. Create more partitions\nclient.create_partition(\n collection_name=\"quick_setup\",\n partition_name=\"partitionA\"\n)\n\nclient.create_partition(\n collection_name=\"quick_setup\",\n partition_name=\"partitionB\"\n)\n\nres = client.list_partitions(collection_name=\"quick_setup\")\nprint(res)\n\n# Output\n#\n# [\"_default\", \"partitionA\", \"partitionB\"]\n","import io.milvus.v2.service.partition.request.CreatePartitionReq;\n\n// 4. Create more partitions\nCreatePartitionReq createPartitionReq = CreatePartitionReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionA\")\n .build();\n\nclient.createPartition(createPartitionReq);\n\ncreatePartitionReq = CreatePartitionReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionB\")\n .build();\n\nclient.createPartition(createPartitionReq);\n\nlistPartitionsReq = ListPartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .build();\n\npartitionNames = client.listPartitions(listPartitionsReq);\n\nSystem.out.println(partitionNames);\n\n// Output:\n// [\n// \"_default\",\n// \"partitionA\",\n// \"partitionB\"\n// ]\n","// 4. Create more partitions\nawait client.createPartition({\n collection_name: \"quick_setup\",\n partition_name: \"partitionA\"\n})\n\nawait client.createPartition({\n collection_name: \"quick_setup\",\n partition_name: \"partitionB\"\n})\n\nres = await client.listPartitions({\n collection_name: \"quick_setup\"\n})\n\nconsole.log(res.partition_names)\n\n// Output\n// \n// [ '_default', 'partitionA', 'partitionB' ]\n// \n","# 5. Check whether a partition exists\nres = client.has_partition(\n collection_name=\"quick_setup\",\n partition_name=\"partitionA\"\n)\nprint(res)\n\n# Output\n#\n# True\n\nres = client.has_partition(\n collection_name=\"quick_setup\",\n partition_name=\"partitionC\"\n)\nprint(res)\n\n# Output\n#\n# False\n","import io.milvus.v2.service.partition.request.HasPartitionReq;\n\n// 5. Check whether a partition exists\nHasPartitionReq hasPartitionReq = HasPartitionReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionA\")\n .build();\n\nboolean exists = client.hasPartition(hasPartitionReq);\n\nSystem.out.println(exists);\n\n// Output:\n// true\n\nhasPartitionReq = HasPartitionReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionC\")\n .build();\n\nexists = client.hasPartition(hasPartitionReq);\n\nSystem.out.println(exists);\n\n// Output:\n// false\n","// 5. Check whether a partition exists\nres = await client.hasPartition({\n collection_name: \"quick_setup\",\n partition_name: \"partitionA\"\n})\n\nconsole.log(res.value)\n\n// Output\n// \n// true\n// \n\nres = await client.hasPartition({\n collection_name: \"quick_setup\",\n partition_name: \"partitionC\"\n})\n\nconsole.log(res.value)\n\n// Output\n// \n// false\n// \n","# Release the collection\nclient.release_collection(collection_name=\"quick_setup\")\n\n# Check the load status\nres = client.get_load_state(collection_name=\"quick_setup\")\nprint(res)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n\nres = client.get_load_state(\n collection_name=\"quick_setup\", \n partition_name=\"partitionA\"\n)\n\nprint(res)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n\nres = client.get_load_state(\n collection_name=\"quick_setup\", \n partition_name=\"partitionB\"\n)\n\nprint(res)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n\n","import io.milvus.v2.service.collection.request.GetLoadStateReq;\nimport io.milvus.v2.service.collection.request.ReleaseCollectionReq;\nimport io.milvus.v2.service.partition.request.LoadPartitionsReq;\nimport io.milvus.v2.service.partition.request.ReleasePartitionsReq;\n\n// 6. Load a partition independantly\n// 6.1 Release the collection\nReleaseCollectionReq releaseCollectionReq = ReleaseCollectionReq.builder()\n .collectionName(\"quick_setup\")\n .build();\n\nclient.releaseCollection(releaseCollectionReq);\n\n// 6.2 Load partitionA\nLoadPartitionsReq loadPartitionsReq = LoadPartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .partitionNames(List.of(\"partitionA\"))\n .build();\n\nclient.loadPartitions(loadPartitionsReq);\n\nThread.sleep(3000);\n\n// 6.3 Check the load status of the collection and its partitions\nGetLoadStateReq getLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .build();\n\nboolean state = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// true\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionA\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// true\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionB\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// false\n","// 6. Load a partition indenpendantly\nawait client.releaseCollection({\n collection_name: \"quick_setup\"\n})\n\nres = await client.getLoadState({\n collection_name: \"quick_setup\"\n})\n\nconsole.log(res.state)\n\n// Output\n// \n// LoadStateNotLoad\n// \n\nawait client.loadPartitions({\n collection_name: \"quick_setup\",\n partition_names: [\"partitionA\"]\n})\n\nawait sleep(3000)\n\nres = await client.getLoadState({\n collection_name: \"quick_setup\"\n})\n\nconsole.log(res.state)\n\n// Output\n// \n// LoadStateLoaded\n// \n\nres = await client.getLoadState({\n collection_name: \"quick_setup\",\n partition_name: \"partitionA\"\n})\n\nconsole.log(res.state)\n\n// Output\n// \n// LoadStateLoaded\n// \n\nres = await client.getLoadState({\n collection_name: \"quick_setup\",\n partition_name: \"partitionB\"\n})\n\nconsole.log(res.state)\n\n// Output\n// \n// LoadStateLoaded\n// \n","client.load_partitions(\n collection_name=\"quick_setup\",\n partition_names=[\"partitionA\"]\n)\n\nres = client.get_load_state(collection_name=\"quick_setup\")\nprint(res)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n","LoadPartitionsReq loadPartitionsReq = LoadPartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .partitionNames(List.of(\"partitionA\"))\n .build();\n\nclient.loadPartitions(loadPartitionsReq);\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionA\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// true\n","await client.loadPartitions({\n collection_name: \"quick_setup\",\n partition_names: [\"partitionA\"]\n})\n\nres = await client.getLoadState({\n collection_name: \"quick_setup\",\n partition_name: \"partitionA\"\n})\n\nconsole.log(res.state)\n\n// Output\n// \n// LoadStateLoaded\n//\n","client.load_partitions(\n collection_name=\"quick_setup\",\n partition_names=[\"partitionA\", \"partitionB\"]\n)\n\nres = client.get_load_state(\n collection_name=\"quick_setup\",\n partition_name=\"partitionA\"\n)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n\nres = client.get_load_state(\n collection_name=\"quick_setup\",\n partition_name=\"partitionB\"\n)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n","LoadPartitionsReq loadPartitionsReq = LoadPartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .partitionNames(List.of(\"partitionA\", \"partitionB\"))\n .build();\n\nclient.loadPartitions(loadPartitionsReq);\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionA\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// true\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionB\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// true\n","await client.loadPartitions({\n collection_name: \"quick_setup\",\n partition_names: [\"partitionA\", \"partitionB\"]\n})\n\nres = await client.getLoadState({\n collection_name: \"quick_setup\",\n partition_name: \"partitionA\"\n})\n\nconsole.log(res)\n\n// Output\n// \n// LoadStateLoaded\n// \n\nres = await client.getLoadState({\n collection_name: \"quick_setup\",\n partition_name: \"partitionB\"\n})\n\nconsole.log(res)\n\n// Output\n// \n// LoadStateLoaded\n// \n","client.load_partitions(\n collection_name=\"quick_setup\",\n partition_names=[\"partitionA\"],\n load_fields=[\"id\", \"vector\"],\n skip_load_dynamic_field=True\n)\n","# 7. Release a partition\nclient.release_partitions(\n collection_name=\"quick_setup\",\n partition_names=[\"partitionA\"]\n)\n\nres = client.get_load_state(\n collection_name=\"quick_setup\", \n partition_name=\"partitionA\"\n)\n\nprint(res)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n\n","import io.milvus.v2.service.partition.request.ReleasePartitionsReq;\n\n// 7. Release a partition\nReleasePartitionsReq releasePartitionsReq = ReleasePartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .partitionNames(List.of(\"partitionA\"))\n .build();\n\nclient.releasePartitions(releasePartitionsReq);\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .partitionName(\"partitionA\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// false\n","// 7. Release a partition\nawait client.releasePartitions({\n collection_name: \"quick_setup\",\n partition_names: [\"partitionA\"]\n})\n\nres = await client.getLoadState({\n collection_name: \"quick_setup\"\n})\n\nconsole.log(res.state)\n\n// Output\n// \n// LoadStateNotLoad\n// \n","client.release_partitions(\n collection_name=\"quick_setup\",\n partition_names=[\"_default\", \"partitionA\", \"partitionB\"]\n)\n\nres = client.get_load_state(\n collection_name=\"quick_setup\",\n)\n\n# Output\n#\n# {\n# \"state\": \"\"\n# }\n","# 8. Drop a partition\nclient.drop_partition(\n collection_name=\"quick_setup\",\n partition_name=\"partitionB\"\n)\n\nres = client.list_partitions(collection_name=\"quick_setup\")\nprint(res)\n\n# Output\n#\n# [\"_default\", \"partitionA\"]\n","import io.milvus.v2.service.partition.request.ReleasePartitionsReq;\n\nReleasePartitionsReq releasePartitionsReq = ReleasePartitionsReq.builder()\n .collectionName(\"quick_setup\")\n .partitionNames(List.of(\"_default\", \"partitionA\", \"partitionB\"))\n .build();\n\nclient.releasePartitions(releasePartitionsReq);\n\ngetLoadStateReq = GetLoadStateReq.builder()\n .collectionName(\"quick_setup\")\n .build();\n\nstate = client.getLoadState(getLoadStateReq);\n\nSystem.out.println(state);\n\n// Output:\n// false\n","\nawait client.releasePartitions({\n collection_name: \"quick_setup\",\n partition_names: [\"_default\", \"partitionA\", \"partitionB\"]\n})\n\nres = await client.getLoadState({\n collection_name: \"quick_setup\"\n})\n\nconsole.log(res)\n\n// Output\n// \n// {\n// status: {\n// error_code: 'Success',\n// reason: '',\n// code: 0,\n// retriable: false,\n// detail: ''\n// },\n// state: 'LoadStateNotLoad'\n// }\n// \n"],"headingContent":"Manage Partitions","anchorList":[{"label":"Manage Partitions","href":"Manage-Partitions","type":1,"isActive":false},{"label":"Overview","href":"Overview","type":2,"isActive":false},{"label":"Preparations","href":"Preparations","type":2,"isActive":false},{"label":"List Partitions","href":"List-Partitions","type":2,"isActive":false},{"label":"Create Partitions","href":"Create-Partitions","type":2,"isActive":false},{"label":"Check for a Specific Partition","href":"Check-for-a-Specific-Partition","type":2,"isActive":false},{"label":"Load & Release Partitions","href":"Load--Release-Partitions","type":2,"isActive":false},{"label":"Drop Partitions","href":"Drop-Partitions","type":2,"isActive":false},{"label":"FAQ","href":"FAQ","type":2,"isActive":false}]} \ No newline at end of file diff --git a/localization/v2.4.x/site/en/userGuide/manage-partitions.md b/localization/v2.4.x/site/en/userGuide/manage-partitions.md index eeaca294e..93deb62b6 100644 --- a/localization/v2.4.x/site/en/userGuide/manage-partitions.md +++ b/localization/v2.4.x/site/en/userGuide/manage-partitions.md @@ -673,7 +673,7 @@ res = await client."partitionA", "partitionB"] ) -res = client.get_load_status( +res = client.get_load_state( collection_name="quick_setup", partition_name="partitionA" ) @@ -684,7 +684,7 @@ res = client.get_load_status( # "state": "<LoadState: Loaded>" # } -res = client.get_load_status( +res = client.get_load_state( collection_name="quick_setup", partition_name="partitionB" ) @@ -844,7 +844,7 @@ res = await client."_default", "partitionA", "partitionB"] ) -res = client.get_load_status( +res = client.get_load_state( collection_name="quick_setup", )