diff --git a/localization/v2.5.x/site/en/userGuide/collections/modify-collection.json b/localization/v2.5.x/site/en/userGuide/collections/modify-collection.json index 1615d1df3..3f1adef7e 100644 --- a/localization/v2.5.x/site/en/userGuide/collections/modify-collection.json +++ b/localization/v2.5.x/site/en/userGuide/collections/modify-collection.json @@ -1 +1 @@ -{"codeList":["from pymilvus import MilvusClient​\n​\nclient = MilvusClient(​\n uri=\"http://localhost:19530\",​\n token=\"root:Milvus\"​\n)​\n​\nclient.rename_collection(​\n old_name=\"my_collection\",​\n new_name=\"my_new_collection\"​\n)​\n\n","import io.milvus.v2.service.collection.request.RenameCollectionReq;​\nimport io.milvus.v2.client.ConnectConfig;​\nimport io.milvus.v2.client.MilvusClientV2;​\n​\nString CLUSTER_ENDPOINT = \"http://localhost:19530\";​\nString TOKEN = \"root:Milvus\";​\n​\n// 1. Connect to Milvus server​\nConnectConfig connectConfig = ConnectConfig.builder()​\n .uri(CLUSTER_ENDPOINT)​\n .token(TOKEN)​\n .build();​\n ​\nMilvusClientV2 client = new MilvusClientV2(connectConfig);​\n​\nRenameCollectionReq renameCollectionReq = RenameCollectionReq.builder()​\n .collectionName(\"my_collection\")​\n .newCollectionName(\"my_new_collection\")​\n .build();​\n​\nclient.renameCollection(renameCollectionReq);​\n\n","import { MilvusClient, DataType } from \"@zilliz/milvus2-sdk-node\";​\n​\nconst address = \"http://localhost:19530\";​\nconst token = \"root:Milvus\";​\nconst client = new MilvusClient({address, token});​\n​\nconst res = await client.renameCollection({​\n oldName: \"my_collection\",​\n newName: \"my_new_collection\"​\n});​\n\n","import (​\n \"context\"​\n \"fmt\"​\n \"log\"​\n​\n \"github.com/milvus-io/milvus/client/v2\"​\n)​\n​\nctx, cancel := context.WithCancel(context.Background())​\ndefer cancel()​\n​\nmilvusAddr := \"127.0.0.1:19530\"​\ntoken := \"root:Milvus\"​\n​\ncli, err := client.New(ctx, &client.ClientConfig{​\n Address: milvusAddr,​\n APIKey: token,​\n})​\nif err != nil {​\n log.Fatal(\"failed to connect to milvus server: \", err.Error())​\n}​\n​\ndefer cli.Close(ctx)​\n​\nerr = cli.RenameCollection(ctx, client.NewRenameCollectionOption(\"my_collection\", \"my_new_collection\"))​\nif err != nil {​\n // handle error​\n}​\n\n","export CLUSTER_ENDPOINT=\"http://localhost:19530\"​\nexport TOKEN=\"root:Milvus\"​\n​\ncurl --request POST \\​\n--url \"${CLUSTER_ENDPOINT}/v2/vectordb/collections/rename\" \\​\n--header \"Authorization: Bearer ${TOKEN}\" \\​\n--header \"Content-Type: application/json\" \\​\n-d '{​\n \"collectionName\": \"my_collection\",​\n \"newCollectionName\": \"my_new_collection\"​\n}'​\n\n","# Currently not available for Python\n\n","import io.milvus.v2.service.collection.request.AlterCollectionReq;​\nimport java.util.HashMap;​\nimport java.util.Map;​\n​\nMap properties = new HashMap<>();​\nproperties.put(\"collection.ttl.seconds\", \"60\");​\n​\nAlterCollectionReq alterCollectionReq = AlterCollectionReq.builder()​\n .collectionName(\"my_collection\")​\n .properties(properties)​\n .build();​\n​\nclient.alterCollection(alterCollectionReq);​\n\n","res = await client.alterCollection({​\n collection_name: \"my_collection\",​\n properties: {​\n \"collection.ttl.seconds\": 60​\n }​\n})​\n\n","import (​\n \"context\"​\n \"fmt\"​\n \"log\"​\n​\n \"github.com/milvus-io/milvus/client/v2\"​\n \"github.com/milvus-io/milvus/pkg/common\"​\n)​\n​\n​\nctx, cancel := context.WithCancel(context.Background())​\ndefer cancel()​\n​\nmilvusAddr := \"127.0.0.1:19530\"​\ntoken := \"root:Milvus\"​\n​\ncli, err := client.New(ctx, &client.ClientConfig{​\n Address: milvusAddr,​\n APIKey: token,​\n})​\nif err != nil {​\n log.Fatal(\"failed to connect to milvus server: \", err.Error())​\n}​\n​\ndefer cli.Close(ctx)​\n​\nerr = cli.AlterCollection(ctx, client.NewAlterCollectionOption(\"my_collection\").WithProperty(common.CollectionTTLConfigKey, 60))​\nif err != nil {​\n // handle error​\n}​\n\n","# Currently not available for REST\n\n"],"headingContent":"Modify Collection​","anchorList":[{"label":"Modify Collection​","href":"Modify-Collection​","type":1,"isActive":false},{"label":"Rename Collection​","href":"Rename-Collection​","type":2,"isActive":false},{"label":"Set Collection TTL​","href":"Set-Collection-TTL​","type":2,"isActive":false}]} \ No newline at end of file +{"codeList":["from pymilvus import MilvusClient​\n​\nclient = MilvusClient(​\n uri=\"http://localhost:19530\",​\n token=\"root:Milvus\"​\n)​\n​\nclient.rename_collection(​\n old_name=\"my_collection\",​\n new_name=\"my_new_collection\"​\n)​\n\n","import io.milvus.v2.service.collection.request.RenameCollectionReq;​\nimport io.milvus.v2.client.ConnectConfig;​\nimport io.milvus.v2.client.MilvusClientV2;​\n​\nString CLUSTER_ENDPOINT = \"http://localhost:19530\";​\nString TOKEN = \"root:Milvus\";​\n​\n// 1. Connect to Milvus server​\nConnectConfig connectConfig = ConnectConfig.builder()​\n .uri(CLUSTER_ENDPOINT)​\n .token(TOKEN)​\n .build();​\n ​\nMilvusClientV2 client = new MilvusClientV2(connectConfig);​\n​\nRenameCollectionReq renameCollectionReq = RenameCollectionReq.builder()​\n .collectionName(\"my_collection\")​\n .newCollectionName(\"my_new_collection\")​\n .build();​\n​\nclient.renameCollection(renameCollectionReq);​\n\n","import { MilvusClient, DataType } from \"@zilliz/milvus2-sdk-node\";​\n​\nconst address = \"http://localhost:19530\";​\nconst token = \"root:Milvus\";​\nconst client = new MilvusClient({address, token});​\n​\nconst res = await client.renameCollection({​\n oldName: \"my_collection\",​\n newName: \"my_new_collection\"​\n});​\n\n","import (​\n \"context\"​\n \"fmt\"​\n \"log\"​\n​\n \"github.com/milvus-io/milvus/client/v2\"​\n)​\n​\nctx, cancel := context.WithCancel(context.Background())​\ndefer cancel()​\n​\nmilvusAddr := \"127.0.0.1:19530\"​\ntoken := \"root:Milvus\"​\n​\ncli, err := client.New(ctx, &client.ClientConfig{​\n Address: milvusAddr,​\n APIKey: token,​\n})​\nif err != nil {​\n log.Fatal(\"failed to connect to milvus server: \", err.Error())​\n}​\n​\ndefer cli.Close(ctx)​\n​\nerr = cli.RenameCollection(ctx, client.NewRenameCollectionOption(\"my_collection\", \"my_new_collection\"))​\nif err != nil {​\n // handle error​\n}​\n\n","export CLUSTER_ENDPOINT=\"http://localhost:19530\"​\nexport TOKEN=\"root:Milvus\"​\n​\ncurl --request POST \\​\n--url \"${CLUSTER_ENDPOINT}/v2/vectordb/collections/rename\" \\​\n--header \"Authorization: Bearer ${TOKEN}\" \\​\n--header \"Content-Type: application/json\" \\​\n-d '{​\n \"collectionName\": \"my_collection\",​\n \"newCollectionName\": \"my_new_collection\"​\n}'​\n\n","from pymilvus import MilvusClient\n\nclient.alter_collection_properties(\n collection_name=\"collection_name\",\n properties = {\"collection.ttl.seconds\": 500}\n)\n","import io.milvus.v2.service.collection.request.AlterCollectionReq;​\nimport java.util.HashMap;​\nimport java.util.Map;​\n​\nMap properties = new HashMap<>();​\nproperties.put(\"collection.ttl.seconds\", \"60\");​\n​\nAlterCollectionReq alterCollectionReq = AlterCollectionReq.builder()​\n .collectionName(\"my_collection\")​\n .properties(properties)​\n .build();​\n​\nclient.alterCollection(alterCollectionReq);​\n\n","res = await client.alterCollection({​\n collection_name: \"my_collection\",​\n properties: {​\n \"collection.ttl.seconds\": 60​\n }​\n})​\n\n","import (​\n \"context\"​\n \"fmt\"​\n \"log\"​\n​\n \"github.com/milvus-io/milvus/client/v2\"​\n \"github.com/milvus-io/milvus/pkg/common\"​\n)​\n​\n​\nctx, cancel := context.WithCancel(context.Background())​\ndefer cancel()​\n​\nmilvusAddr := \"127.0.0.1:19530\"​\ntoken := \"root:Milvus\"​\n​\ncli, err := client.New(ctx, &client.ClientConfig{​\n Address: milvusAddr,​\n APIKey: token,​\n})​\nif err != nil {​\n log.Fatal(\"failed to connect to milvus server: \", err.Error())​\n}​\n​\ndefer cli.Close(ctx)​\n​\nerr = cli.AlterCollection(ctx, client.NewAlterCollectionOption(\"my_collection\").WithProperty(common.CollectionTTLConfigKey, 60))​\nif err != nil {​\n // handle error​\n}​\n\n","# Currently not available for REST\n\n"],"headingContent":"Modify Collection​","anchorList":[{"label":"Modify Collection​","href":"Modify-Collection​","type":1,"isActive":false},{"label":"Rename Collection​","href":"Rename-Collection​","type":2,"isActive":false},{"label":"Set Collection TTL​","href":"Set-Collection-TTL​","type":2,"isActive":false}]} \ No newline at end of file diff --git a/localization/v2.5.x/site/en/userGuide/collections/modify-collection.md b/localization/v2.5.x/site/en/userGuide/collections/modify-collection.md index 26419350c..365c38b4b 100644 --- a/localization/v2.5.x/site/en/userGuide/collections/modify-collection.md +++ b/localization/v2.5.x/site/en/userGuide/collections/modify-collection.md @@ -147,7 +147,7 @@ curl --request POST \​ d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z" > -

If a collection needs to be dropped for a specific period, consider setting its Time-To-Live (TTL) in seconds. Once the TTL times out, Milvus deletes entities in the collection and drops the collection. The deletion is asynchronous, indicating that searches and queries are still possible before the deletion is complete.​

+

If a collection needs to be dropped for a specific period, consider setting its Time-To-Live (TTL) in seconds. Once the TTL times out, Milvus deletes entities in the collection. The deletion is asynchronous, indicating that searches and queries are still possible before the deletion is complete.​

The following code snippet demonstrates how to change the TTL of a collection.​

Python @@ -156,8 +156,12 @@ curl --request POST \​ Go cURL
-
# Currently not available for Python
+
from pymilvus import MilvusClient
 
+client.alter_collection_properties(
+  collection_name="collection_name",
+  properties = {"collection.ttl.seconds": 500}
+)
 
import io.milvus.v2.service.collection.request.AlterCollectionReq;​
 import java.util.HashMap;​