From 78a3e5134a687dee6977c8a2e67b6d6b75c8ad4b Mon Sep 17 00:00:00 2001 From: Milvus-doc-bot Date: Tue, 12 Sep 2023 13:33:02 +0000 Subject: [PATCH] Release new docs --- .../getstarted/install_SDKs/install-csharp.md | 2 +- v2.2.x/site/en/menuStructure/en.json | 8 + v2.2.x/site/en/userGuide/build_index.md | 121 ++--------- .../site/en/userGuide/build_scalar_index.md | 20 ++ v2.2.x/site/en/userGuide/check_collection.md | 101 ++------- v2.2.x/site/en/userGuide/check_partition.md | 120 ++--------- v2.2.x/site/en/userGuide/collection_alias.md | 137 ++++-------- v2.2.x/site/en/userGuide/compact_data.md | 57 +---- v2.2.x/site/en/userGuide/create_collection.md | 111 +++++++++- v2.2.x/site/en/userGuide/create_partition.md | 51 +---- v2.2.x/site/en/userGuide/delete_data.md | 90 +++++--- v2.2.x/site/en/userGuide/drop_collection.md | 25 +-- v2.2.x/site/en/userGuide/drop_index.md | 43 +--- v2.2.x/site/en/userGuide/drop_partition.md | 47 +--- v2.2.x/site/en/userGuide/insert_data.md | 50 +++-- v2.2.x/site/en/userGuide/load_collection.md | 78 +++---- v2.2.x/site/en/userGuide/load_partition.md | 52 ++--- .../site/en/userGuide/manage_collections.md | 20 -- v2.2.x/site/en/userGuide/manage_connection.md | 35 ++- v2.2.x/site/en/userGuide/manage_data.md | 14 -- v2.2.x/site/en/userGuide/manage_indexes.md | 12 -- v2.2.x/site/en/userGuide/manage_partitions.md | 18 -- v2.2.x/site/en/userGuide/modify_collection.md | 19 +- v2.2.x/site/en/userGuide/release_partition.md | 56 ++--- v2.2.x/site/en/userGuide/rename_collection.md | 55 ++++- .../site/en/userGuide/search/hybridsearch.md | 202 +++++------------- v2.2.x/site/en/userGuide/search/query.md | 58 +++-- v2.2.x/site/en/userGuide/search/search.md | 165 ++++++++------ 28 files changed, 669 insertions(+), 1098 deletions(-) delete mode 100644 v2.2.x/site/en/userGuide/manage_collections.md delete mode 100644 v2.2.x/site/en/userGuide/manage_data.md delete mode 100644 v2.2.x/site/en/userGuide/manage_indexes.md delete mode 100644 v2.2.x/site/en/userGuide/manage_partitions.md diff --git a/v2.2.x/site/en/getstarted/install_SDKs/install-csharp.md b/v2.2.x/site/en/getstarted/install_SDKs/install-csharp.md index 07f6b2499..8d59151cf 100644 --- a/v2.2.x/site/en/getstarted/install_SDKs/install-csharp.md +++ b/v2.2.x/site/en/getstarted/install_SDKs/install-csharp.md @@ -29,7 +29,7 @@ Run the following command to install Milvus C# SDK. Having installed Milvus Java SDK, you can: - Learn the basic operations of Milvus: - - [Manage Database](manage_database.md) + - [Manage Database](manage_databases.md) - [Connect to Milvus server](manage_connection.md) - [Create a collection](create_collection.md) - [Create a partition](create_partition.md) diff --git a/v2.2.x/site/en/menuStructure/en.json b/v2.2.x/site/en/menuStructure/en.json index 489130550..294e38034 100644 --- a/v2.2.x/site/en/menuStructure/en.json +++ b/v2.2.x/site/en/menuStructure/en.json @@ -175,6 +175,14 @@ "label3": "", "order": 3 }, + { + "id": "install-csharp.md", + "title": "C# SDK", + "label1": "getstarted", + "label2": "install_sdks", + "label3": "", + "order": 3 + }, { "id": "milvus_lite.md", "title": "With Milvus Lite", diff --git a/v2.2.x/site/en/userGuide/build_index.md b/v2.2.x/site/en/userGuide/build_index.md index c054a8c9d..37b254dde 100644 --- a/v2.2.x/site/en/userGuide/build_index.md +++ b/v2.2.x/site/en/userGuide/build_index.md @@ -26,8 +26,9 @@ Prepare the index parameters as follows:
Python Java - GO + Go Node.js + C#
```python @@ -61,42 +62,12 @@ final IndexType INDEX_TYPE = IndexType.IVF_FLAT; // IndexType final String INDEX_PARAM = "{\"nlist\":1024}"; // ExtraParam ``` -
- -```shell -create index - -Collection name (book): book - -The name of the field to create an index for (book_intro): book_intro - -Index type (FLAT, IVF_FLAT, IVF_SQ8, IVF_PQ, RNSG, HNSW, ANNOY): IVF_FLAT - -Index metric type (L2, IP, HAMMING, TANIMOTO): L2 - -Index params nlist: 1024 - -Timeout []: +```csharp +var indexType = IndexType.IvfFlat; +var metricType = SimilarityMetricType.L2; +var extraParams = new Dictionary { ["nlist"] = "1024" }; ``` -```curl -curl -X 'POST' \ - 'http://localhost:9091/api/v1/index' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book", - "field_name": "book_intro", - "extra_params":[ - {"key": "metric_type", "value": "L2"}, - {"key": "index_type", "value": "IVF_FLAT"}, - {"key": "params", "value": "{\"nlist\":1024}"} - ] - }' -``` - -
- @@ -307,22 +278,7 @@ curl -X 'POST' \
- - - - - - - - - - - - - - - - + @@ -331,57 +287,31 @@ curl -X 'POST' \ - - - - - - - - - - - - - - + - + - +
Parameter
collection_nameName of the collection to build the index on.
field_nameName of the vector field to build the index on.
metric_typeType of metrics used to measure the similarity of vectors.For floating point vectors: -
    -
  • L2 (Euclidean distance)
  • -
  • IP (Inner product)
  • -
- For binary vectors: -
    -
  • JACCARD (Jaccard distance)
  • -
  • TANIMOTO (Tanimoto distance)
  • -
  • HAMMING (Hamming distance)
  • -
  • SUPERSTRUCTURE (Superstructure)
  • -
  • SUBSTRUCTURE (Substructure)
  • -
-
index_typeindexType Type of index used to accelerate the vector search. For floating point vectors:
    -
  • FLAT (FLAT)
  • -
  • IVF_FLAT (IVF_FLAT)
  • -
  • IVF_SQ8 (IVF_SQ8)
  • -
  • IVF_PQ (IVF_PQ)
  • -
  • HNSW (HNSW)
  • -
  • ANNOY (ANNOY)
  • +
  • IndexType.Flat (FLAT)
  • +
  • IndexType.IvfFlat (IVF_FLAT)
  • +
  • IndexType.IvfSq8 (IVF_SQ8)
  • +
  • IndexType.IvfPq (IVF_PQ)
  • +
  • IndexType.Hnsw (HNSW)
  • +
  • IndexType.Annoy (ANNOY)
For binary vectors:
    -
  • BIN_FLAT (BIN_FLAT)
  • -
  • BIN_IVF_FLAT (BIN_IVF_FLAT)
  • +
  • IndexType.BinFlat (BIN_FLAT)
  • +
  • IndexType.BinIvfFlat (BIN_IVF_FLAT)
paramsExtraParam Building parameter(s) specific to the index. See In-memory Index for more information.
## Build index @@ -391,8 +321,9 @@ Build the index by specifying the vector field name and index parameters.
Python Java - GO + Go Node.js + C#
```python @@ -442,18 +373,10 @@ milvusClient.createIndex( ); ``` -
- -```shell -# Follow the previous step. +```csharp +await milvusClient.GetCollection("book").CreateIndexAsync("book_intro", indexType, metricType, extraParams: extraParams); ``` -```curl -# Follow the previous step. -``` - -
- diff --git a/v2.2.x/site/en/userGuide/build_scalar_index.md b/v2.2.x/site/en/userGuide/build_scalar_index.md index 4c611f1bc..9721e517d 100644 --- a/v2.2.x/site/en/userGuide/build_scalar_index.md +++ b/v2.2.x/site/en/userGuide/build_scalar_index.md @@ -20,6 +20,11 @@ To build an index on scalar fields, you do not need to set any index parameters. The following code snippet assumes that a collection named `book` already exists and an index is to be created on the string field `book_name`. +
+ Python + C# +
+ ```python from pymilvus import Collection @@ -31,8 +36,19 @@ collection.create_index( collection.load() ``` +```csharp +var collection = milvusClient.GetCollection("book"); +await collection.CreateIndexAsync("book_name", indexName: "scalar_index"); +await collection.LoadAsync(); +``` + Once the index has been created, you can include a boolean expression on this string field in a vector similarity search as follows: +
+ Python + C# +
+ ```python search_param = { "data": [[0.1, 0.2]], @@ -44,6 +60,10 @@ search_param = { res = collection.search(**search_param) ``` +```csharp + +``` + ## What's next - To learn more about scalar field indexing, read [Scalar Index](scalar_index.md). diff --git a/v2.2.x/site/en/userGuide/check_collection.md b/v2.2.x/site/en/userGuide/check_collection.md index 85633cf5f..3a479d110 100644 --- a/v2.2.x/site/en/userGuide/check_collection.md +++ b/v2.2.x/site/en/userGuide/check_collection.md @@ -15,12 +15,14 @@ Verify if a collection exists in Milvus.
Python Java - GO + Go Node.js + C#
```python from pymilvus import utility + utility.has_collection("book") ``` @@ -51,36 +53,11 @@ if (respHasCollection.getData() == Boolean.TRUE) { System.out.println("Collection exists."); } ``` -
- -```shell -describe collection -c book -``` -```curl -curl -X 'GET' \ - 'http://localhost:9091/api/v1/collection/existence' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book" - }' +```csharp +var collectionExists = await Client.HasCollectionAsync("book"); ``` -
-Output: - -```json -{ - "status":{}, - "value":true -} -``` - -
- -
-
@@ -96,7 +73,6 @@ Output:
- @@ -131,7 +107,6 @@ Output:
- @@ -147,22 +122,7 @@ Output:
- - - - - - - - - - - - - - - - + @@ -171,11 +131,10 @@ Output: - + - -
Parameter
collection_namecollectionName Name of the collection to check.
+ ## Check collection details @@ -184,8 +143,9 @@ Check the details of a collection.
Python Java - GO + Go Node.js + C# Curl
@@ -253,14 +213,11 @@ GetCollStatResponseWrapper wrapperCollectionStatistics = new GetCollStatResponse System.out.println("Collection row count: " + wrapperCollectionStatistics.getRowCount()); ``` -
- -```shell -describe collection -c book +```csharp +var collection = milvusClient.GetCollection("book"); +var desc = await collection.DescribeAsync(); ``` -
- ```curl curl -X 'GET' \ '${MILVUS_HOST}:${MILVUS_PORT}/v1/vector/collections/describe' \ @@ -304,7 +261,6 @@ Output: } } ``` - @@ -394,21 +350,6 @@ Output:
- - - - - - - - - - - - - - - @@ -431,13 +372,12 @@ List all collections in this Milvus Instance.
Python Java - GO + Go Node.js - CLI + C# Curl
- ```python from pymilvus import utility utility.list_collections() @@ -463,13 +403,14 @@ R respShowCollections = milvusClient.showCollections( ); System.out.println(respShowCollections); ``` -
-```shell -list collections -``` +```csharp +var collections = await milvusClient.ListCollectionsAsync(); -
+foreach (var collection in collections) { + Console.WriteLine(collection.Name); +} +``` ```curl curl -X 'GET' \ diff --git a/v2.2.x/site/en/userGuide/check_partition.md b/v2.2.x/site/en/userGuide/check_partition.md index 942293cce..c87e28835 100644 --- a/v2.2.x/site/en/userGuide/check_partition.md +++ b/v2.2.x/site/en/userGuide/check_partition.md @@ -15,8 +15,9 @@ Verify if a partition exists in the specified collection. ```python @@ -56,34 +57,10 @@ if (respHasPartition.getData() == Boolean.TRUE) { } ``` -
- -```shell -describe partition -c book -p novel -``` - -``` curl -curl -X 'GET' \ - 'http://localhost:9091/api/v1/partition/existence' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book", - "partition_name": "novel" - }' -``` - -
-Output: - -```json -{"status":{},"value":true} +```csharp +var exists = await milvusClient.GetCollection("book").HasPartitionAsync("novel"); ``` -
- -
-
@@ -143,26 +120,7 @@ Output:
- - - - - - - - - - - - - - - - - - - - + @@ -186,8 +144,9 @@ Output:
Python Java - GO + Go Node.js + C#
```python @@ -222,49 +181,9 @@ R respShowPartitions = milvusClient.showPartitions( System.out.println(respShowPartitions); ``` -
- -```shell -list partitions -c book -``` - -``` curl -curl -X 'GET' \ - 'http://localhost:9091/api/v1/partitions' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book" - }' -``` - -
-Output: - -```json -{ - "status": {}, - "partition_names": [ - "_default", - "novel" - ], - "partitionIDs": [ - 434261413928632322, - 434261764795531265 - ], - "created_timestamps": [ - 434261413928632323, - 434261764795531266 - ], - "created_utc_timestamps": [ - 1656575828280, - 1656577166731 - ] -} +```csharp +var partitions = await milvusClient.GetCollection("book").ShowPartitionsAsync(); ``` -
- -
Parameter
@@ -315,31 +234,16 @@ Output:
- - - - - - - - - - - - - - - - + - + - + diff --git a/v2.2.x/site/en/userGuide/collection_alias.md b/v2.2.x/site/en/userGuide/collection_alias.md index d2bf92496..0d852a4a3 100644 --- a/v2.2.x/site/en/userGuide/collection_alias.md +++ b/v2.2.x/site/en/userGuide/collection_alias.md @@ -21,8 +21,9 @@ Specify an alias for a collection.
Python Java - GO + Go Node.js + C#
```python @@ -52,29 +53,11 @@ milvusClient.createAlias( .build() ); ``` -
-```shell -create alias -c book -a publication +```csharp +await milvusClient.CreateAliasAsync("book", "publication"); ``` -```curl -curl -X 'POST' \ - 'http://localhost:9091/api/v1/alias' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book", - "alias":"publication" - }' -``` -```curl -# Output: -{} -``` - -
-
OptionParameter Description
-ccollectionName Name of the collection to check.
@@ -156,7 +139,7 @@ curl -X 'POST' \
- + @@ -165,7 +148,7 @@ curl -X 'POST' \ - + @@ -182,8 +165,9 @@ Drop a specified alias.
Python Java - GO + Go Node.js + C#
```python @@ -198,7 +182,7 @@ await milvusClient.dropAlias({ ``` ```go -// This function is under active development on the GO client. +client.DropAlias(context.Background(), "publication") ``` ```java @@ -209,28 +193,10 @@ milvusClient.dropAlias( ); ``` -
- -```shell -delete alias -a publication -``` - -```curl -curl -X 'DELETE' \ - 'http://localhost:9091/api/v1/alias' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "alias":"publication" - }' -``` -```curl -# Output: -{} +```csharp +await milvusClient.DropAliasAsync("publication"); ``` -
-
Parameter
collection_namecollectionName Name of the collection to create alias on.
@@ -277,22 +243,22 @@ curl -X 'DELETE' \
- - + + - + - - + + - + - +
OptionParameter Description
-aalias Collection alias to drop.
- + @@ -314,8 +280,9 @@ Alter an existing alias to another collection. The following example is based on
Python Java - GO + Go Node.js + C#
```python @@ -334,7 +301,7 @@ await milvusClient.alterAlias({ ``` ```go -// This function is under active development on the GO client. +client.AlterAlias(context.Background(), "book", "publication") ``` ```java @@ -346,34 +313,12 @@ milvusClient.alterAlias( ); ``` -
- -```shell -create alias -c book -A -a publication -``` - -```curl -curl -X 'PATCH' \ - 'http://localhost:9091/api/v1/alias' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book", - "alias":"publication" - }' -``` - -
-Output: - -```json -{} +```csharp +await milvusClient.AlterAliasAsync("book", "publication"); ```
-
-
Parameter
@@ -384,11 +329,11 @@ Output: - + - +
collection_nameName of the collection to alter alias to.Name of the collection.
aliasCollection alias to alter.New alias
@@ -404,11 +349,11 @@ Output: collection_name - Name of the collection to alter alias to. + Name of the collection alias - Collection alias to alter. + New alias @@ -423,16 +368,16 @@ Output: CollectionName - Name of the collection to alter alias to. + Name of the collection. Alias - Collection alias to alter. + New alias. - + @@ -441,21 +386,17 @@ Output: - - - - - - + + - - + +
Option
-cName of the collection to alter alias to.
-aCollection alias to alter.collNameName of the collection.
-AFlag to transfer the alias to a specified collection.aliasNew Alias
- + @@ -464,12 +405,12 @@ Output: - - + + - +
Parameter
collection_nameName of the collection to alter alias to.collectionNameName of the collection
aliasCollection alias to alter.New Alias
diff --git a/v2.2.x/site/en/userGuide/compact_data.md b/v2.2.x/site/en/userGuide/compact_data.md index 72fc325b9..7c43dd97e 100644 --- a/v2.2.x/site/en/userGuide/compact_data.md +++ b/v2.2.x/site/en/userGuide/compact_data.md @@ -23,8 +23,9 @@ Compaction requests are processed asynchronously because they are usually time-c
Python Java - GO + Go Node.js + C#
```python @@ -53,33 +54,10 @@ R response = milvusClient.manualCompaction( long compactionID = response.getData().getCompactionID(); ``` -
- -```shell -compact -c book -``` - -```curl -curl -X 'POST' \ - 'http://localhost:9091/api/v1/compaction' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collectionID": 434262071120432449 - }' -``` - -
-Output: - -```json -{"status":{},"compactionID":434262132129005569} +```csharp +await milvusClient.GetCollection("book").CompactAsync(); ``` -
- -
- @@ -157,33 +135,6 @@ milvusClient.getCompactionState(GetCompactionStateParam.newBuilder() ); ``` -
- -```shell -show compaction_state -c book -``` - -```curl -curl -X 'GET' \ - 'http://localhost:9091/api/v1/compaction/state' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "compactionID": 434262132129005569 - }' -``` - -
-Output: - -```json -{"status":{},"state":2} -``` - -
- -
- ## What's next - Learn more basic operations of Milvus: diff --git a/v2.2.x/site/en/userGuide/create_collection.md b/v2.2.x/site/en/userGuide/create_collection.md index 881c7a595..a99cd7eb8 100644 --- a/v2.2.x/site/en/userGuide/create_collection.md +++ b/v2.2.x/site/en/userGuide/create_collection.md @@ -25,6 +25,7 @@ First, prepare necessary parameters, including field schema, collection schema, JavaGONode.js + C#Curl @@ -184,6 +185,21 @@ Output: } ``` +```csharp +var schema = new CollectionSchema +{ + Fields = + { + FieldSchema.Create("book_id", isPrimaryKey: true), + FieldSchema.CreateVarchar("book_name", maxLength: 200), + FieldSchema.Create("word_count"), + FieldSchema.CreateFloatVector("book_intro", dimension: 2) + }, + Description = "Test book search", + EnableDynamicFields = true +}; +``` +
@@ -571,6 +587,38 @@ Output:
+ + + + + + + + + + + + + + + + + + +
ClassDescriptionOption
CollectionSchema + The logical definition of a collection, describing the fields which makes it up.Possible parameters:
    +
  • Fields: A list of Fields derived from the FieldSchema class.
  • +
  • Description: (Optional) Description of the collection schema.
  • +
  • EnableDynamicFields: (Optional) Whether to enable dynamic fields.
  • +
FieldSchema + The logical definition of a collection, describing the fields which makes it up.Possible methods:
    +
  • Create(string name, MilvusDataType dataType, bool isPrimaryKey, bool autoId, bool isPartitionKey, string description)
  • +
  • Create(string name, bool isPrimaryKey, bool autoId, bool isPartitionKey, string description)
  • +
  • CreateVarchar(string name, int maxLength, bool isPrimaryKey, bool autoId, bool isPartitionKey, string description)
  • +
  • CreateFloatVector(string name, int dimension, string description)
  • +
  • CreateBinaryVector(string name, int dimension, string description)
  • +
  • CreateJson(string name)
  • +
## Create a collection with the schema Then, create a collection with the schema you specified above. @@ -580,6 +628,8 @@ Then, create a collection with the schema you specified above. Java GO Node.js + C# + Curl ```python @@ -593,7 +643,7 @@ collection = Collection( ``` ```javascript -await milvusClient.createCollection(params); +await milvusClient.createCollection(param); ``` ```go @@ -611,6 +661,26 @@ if err != nil { milvusClient.createCollection(createCollectionReq); ``` +```csharp +var collection = await milvusClient.CreateCollectionAsync(collectionName, schema, shardsNum: 2); +``` + +```curl +curl --request POST \ + --url "${MILVUS_HOST}:${MILVUS_PORT}/v1/vector/collections/create" \ + --header "Authorization: Bearer ${TOKEN}" \ + --header "accept: application/json" \ + --header "content-type: application/json" \ + -d '{ + "dbName": "default", + "collectionName": "medium_articles", + "dimension": 256, + "metricType": "L2", + "primaryField": "id", + "vectorField": "vector" + }' +``` + @@ -665,6 +735,45 @@ milvusClient.createCollection(createCollectionReq);
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterDescriptionOption
collectionNameName of the collection.N/A
schemaSchema of the collection. Should be a CollectionSchema object.N/A
consistencyLevelConsistency Level of the collection.Possible values are
    +
  • ConsistencyLevel.Strong
  • +
  • ConsistencyLevel.Session
  • +
  • ConsistencyLevel.BoundedStaleness
  • +
  • ConsistencyLevel.Eventually
  • +
  • ConsistencyLevel.Customized
  • +
shardsNumNumber of shards to create.N/A
+ ## Limits | Feature | Maximum limit | diff --git a/v2.2.x/site/en/userGuide/create_partition.md b/v2.2.x/site/en/userGuide/create_partition.md index 7228eb8d6..2608b6ba7 100644 --- a/v2.2.x/site/en/userGuide/create_partition.md +++ b/v2.2.x/site/en/userGuide/create_partition.md @@ -20,6 +20,7 @@ The following example builds a partition `novel` in the collection `book`. Java GO Node.js + C# ```python @@ -55,25 +56,10 @@ milvusClient.createPartition( ); ``` -
- -```shell -create partition -c book -p novel -``` - -```curl -curl -X 'POST' \ - 'http://localhost:9091/api/v1/partition' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book", - "partition_name": "novel" - }' +```csharp +var collection = milvusClient.GetCollection("book").CreatePartitionAsync("novel"); ``` -
- @@ -155,48 +141,25 @@ curl -X 'POST' \
- + - + - + - + - - - -
OptionParameter Description
-ccollectionName The name of the collection.
-ppartitionName The partition name.
-d (Optional)The description of the partition.
- - - - - - - - - - - - - - - - - - - ## Limits |Feature |Maximum limit| |---|---| diff --git a/v2.2.x/site/en/userGuide/delete_data.md b/v2.2.x/site/en/userGuide/delete_data.md index 7e964234a..08035c3e6 100644 --- a/v2.2.x/site/en/userGuide/delete_data.md +++ b/v2.2.x/site/en/userGuide/delete_data.md @@ -34,6 +34,7 @@ The following example filters data with primary key values of `0` and `1`. Java GO Node.js + C# Curl @@ -49,39 +50,18 @@ const expr = "book_id in [0,1]"; private static final String DELETE_EXPR = "book_id in [0,1]"; ``` -
- -```shell -delete entities -c book -The expression to specify entities to be deleted: book_id in [0,1] +```go +pks := entity.NewColumnInt64("book_id", []int64{0, 1}) ``` -
+```csharp +var expression = "book_id in [0,1]"; +``` ```curl # See the following section. ``` - - - - - - - - - - - - - - - - - -
OptionDescription
-cThe name of the collection.
-p (Optional)The name of the partition that the entities belong to.
- - ## Delete entities Delete the entities with the boolean expression you created. Milvus returns the ID list of the deleted entities. @@ -91,6 +71,7 @@ Delete the entities with the boolean expression you created. Milvus returns the Java GO Node.js + C# Curl @@ -108,7 +89,7 @@ await milvusClient.deleteEntities({ ``` ```go -// This function is under active development on the GO client. +client.DeleteByPks("book", pks) ``` ```java @@ -120,15 +101,10 @@ milvusClient.delete( ); ``` -
- -```shell -You are trying to delete the entities of collection. This action cannot be undone! -Do you want to continue? [y/N]: y +```csharp +await milvusClient.GetCollection("book").DeleteAsync(expression); ``` -
- ```curl curl -X 'DELETE' \ '${MILVUS_HOST}:${MILVUS_PORT}/v1/vector/delete' \ @@ -218,6 +194,52 @@ Output: + + + + + + + + + + + + + + + + + + + + + +
ParameterDescription
collNameName of the collection to delete entities from.
partitionName (optional)Name of the partition to delete entities from.
idsA set of ids to delete.
+ + + + + + + + + + + + + + + + + + + + + + +
ParameterDescription
CollectionNameName of the collection to delete entities from. You should get a collection and call its InsertAsync with the following parameters.
expressionBoolean expression that specifies the entities to delete.
PartitionName (optional)Name of the partition to delete entities from.
+ diff --git a/v2.2.x/site/en/userGuide/drop_collection.md b/v2.2.x/site/en/userGuide/drop_collection.md index d3bfb3ef1..03cbb1e10 100644 --- a/v2.2.x/site/en/userGuide/drop_collection.md +++ b/v2.2.x/site/en/userGuide/drop_collection.md @@ -18,6 +18,7 @@ Dropping a collection irreversibly deletes all data within it. JavaGONode.js + C#Curl @@ -48,14 +49,11 @@ milvusClient.dropCollection( ); ``` -
- -```shell -delete collection -c book +```csharp +var collection = Client.GetCollection("book"); +await collection.DropAsync(); ``` -
- ```curl curl -X 'DELETE' \ '${MILVUS_HOST}:${MILVUS_PORT}/v1/vector/collections/drop' \ @@ -143,21 +141,6 @@ Output:
- - - - - - - - - - - - - - - diff --git a/v2.2.x/site/en/userGuide/drop_index.md b/v2.2.x/site/en/userGuide/drop_index.md index c2e5412e2..ac721050a 100644 --- a/v2.2.x/site/en/userGuide/drop_index.md +++ b/v2.2.x/site/en/userGuide/drop_index.md @@ -15,8 +15,9 @@ Dropping an index irreversibly removes all corresponding index files. ```python @@ -51,25 +52,10 @@ milvusClient.dropIndex( ); ``` -
- -```shell -delete index -c book -``` - -```curl -curl -X 'DELETE' \ - 'http://localhost:9091/api/v1/index' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book", - "field_name": "book_intro" - }' +```csharp +await milvusClient.GetCollection("book").DropIndexAsync("book_intro"); ``` -
-
@@ -127,22 +113,7 @@ curl -X 'DELETE' \
- - - - - - - - - - - - - - - - + @@ -151,11 +122,11 @@ curl -X 'DELETE' \ - + - + diff --git a/v2.2.x/site/en/userGuide/drop_partition.md b/v2.2.x/site/en/userGuide/drop_partition.md index 0fb6e5fe8..4ea010afe 100644 --- a/v2.2.x/site/en/userGuide/drop_partition.md +++ b/v2.2.x/site/en/userGuide/drop_partition.md @@ -15,13 +15,12 @@ This topic describes how to drop a partition in a specified collection. - - ```python @@ -56,25 +55,10 @@ milvusClient.dropPartition( ); ``` -
- -```shell -delete partition -c book -p novel -``` - -```curl -curl -X 'DELETE' \ - 'http://localhost:9091/api/v1/partition' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book", - "partition_name": "novel" - }' +```csharp +await milvusClient.GetCollection("book").DropPartitionsAsync("novel"); ``` -
-
Parameter
collection_namecollectionName Name of the collection to drop index on.
field_namefieldName Name of the vector field to drop index on.
@@ -152,26 +136,7 @@ curl -X 'DELETE' \
- - - - - - - - - - - - - - - - - - - - + @@ -180,11 +145,11 @@ curl -X 'DELETE' \ - + - + diff --git a/v2.2.x/site/en/userGuide/insert_data.md b/v2.2.x/site/en/userGuide/insert_data.md index d1f023349..70d4ccbb3 100644 --- a/v2.2.x/site/en/userGuide/insert_data.md +++ b/v2.2.x/site/en/userGuide/insert_data.md @@ -25,6 +25,7 @@ Once you enable dynamic schema, you can append dynamic fields in the data. For d JavaGONode.js + C#Curl @@ -84,14 +85,19 @@ for (long i = 0L; i < 2000; ++i) { } ``` -
+```csharp +var bookIds = new long[2000]; +var wordCounts = new long[2000]; +var bookIntros = new ReadOnlyMemory[2000]; -```shell -# Prepare your data in a CSV file. Milvus CLI only supports importing data from local or remote files. +for (var i = 0; i < 2000; i++) +{ + bookIds[i] = i; + wordCounts[i] = i + 10000; + bookIntros[i] = new[] { Random.Shared.NextSingle(), Random.Shared.NextSingle() }; +} ``` -
- ```curl # See the following step. ``` @@ -107,11 +113,10 @@ By specifying `partition_name`, you can optionally decide to which partition to JavaGONode.js - CLI + C#Curl - ```python from pymilvus import Collection collection = Collection("book") # Get an existing collection. @@ -153,14 +158,15 @@ InsertParam insertParam = InsertParam.newBuilder() milvusClient.insert(insertParam); ``` -
- -```shell -import -c book 'https://raw.githubusercontent.com/milvus-io/milvus_cli/main/examples/user_guide/search.csv' +```csharp +await milvusClient.GetCollection("book").InsertAsync(new FieldData[] +{ + FieldData.Create("book_id", bookIds), + FieldData.Create("word_count", wordCounts), + FieldData.CreateFloatVector("book_intro", bookIntros) +}); ``` -
- ```curl # insert an entity to a collection curl -X 'POST' \ @@ -320,21 +326,29 @@ Output:
Parameter
collection_namecollectionName Name of the collection to drop partition from.
partition_namepartitionName Name of the partition to drop.
- + - + + - - + + + + + + + + - + +
OptionParameter DescriptionOption
-cName of the collection to insert data into.collectionNameThe name of the collection to which entities will be inserted. You should get a collection and call its InsertAsync with the following parameters.N/A
dataData to insert into Milvus. Should be a list of FieldData object.N/A
-p (Optional)partitionName Name of the partition to insert data into.N/A
diff --git a/v2.2.x/site/en/userGuide/load_collection.md b/v2.2.x/site/en/userGuide/load_collection.md index 1ca3229ed..1f5f4b1c1 100644 --- a/v2.2.x/site/en/userGuide/load_collection.md +++ b/v2.2.x/site/en/userGuide/load_collection.md @@ -22,6 +22,7 @@ Milvus allows users to load a collection as multiple replicas to utilize the CPU Java GO Node.js + C# ```python @@ -43,8 +44,6 @@ utility.loading_progress("book") await milvusClient.loadCollection({ collection_name: "book", }); - - ``` ```go @@ -107,32 +106,17 @@ if (response.getStatus() != R.Status.Success.getCode()) { } System.out.println(response.getProgress()); ``` -
-```shell -load -c book -``` -``` curl -curl -X 'POST' \ - 'http://localhost:9091/api/v1/collection/load' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book" - }' -``` +```csharp +var collection = Client.GetCollection("book") +await collection.LoadAsync(); -
-Output: +// You can check the loading progress -```json -{} +var progress = await collection.GetLoadingProgressAysnc(); +Console.WriteLine(progress); ``` -
- -
- @@ -205,7 +189,7 @@ Output:
- + @@ -214,35 +198,23 @@ Output: - - - - - +
Option
-cName of the collection to load.
-p (Optional/Multiple)(Optional) replicaNumber The name of the partition to load.
- - - - - - - - - - - - - - - ## Get replica information You can check the information of the loaded replicas. + + ```python from pymilvus import Collection collection = Collection("book") # Get an existing collection. @@ -251,6 +223,24 @@ result = collection.get_replicas() print(result) ``` +```java +GetReplicasParam getReplicasParam = GetReplicasParam.newBuilder() + .withCollectionName("book") + .build(); + +client.getReplicas(getReplicasParam); +``` + +```go +replicas, err = client.GetReplicas(context.Background(), "book") +``` + +```javascript +let res = client.getReplicas({ + collectionID: '436777253933154305' // should be a collection id returned by a compact task. +}) +``` + Below is an example of the output. ``` diff --git a/v2.2.x/site/en/userGuide/load_partition.md b/v2.2.x/site/en/userGuide/load_partition.md index 37f6d6c78..8de040051 100644 --- a/v2.2.x/site/en/userGuide/load_partition.md +++ b/v2.2.x/site/en/userGuide/load_partition.md @@ -22,6 +22,7 @@ Milvus 2.1 or later allows users to load a partition as multiple replicas to uti Java GO Node.js + C# ```python @@ -63,26 +64,16 @@ milvusClient.loadPartitions( ); ``` -
+```csharp +await milvusClient.GetCollection("book").LoadPartitionAsync("novel"); -```shell -load -c book -p novel +// To load multiple partitions: +// await milvusClient.GetCollection("book").LoadPartitionsAsync(partitionNames: new List { +// "novel", +// "history" +// }); ``` -``` curl -curl -X 'POST' \ - 'http://localhost:9091/api/v1/partitions/load' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book", - "partition_names": ["novel"], - "replica_number": 1 - }' -``` - -
- @@ -167,26 +158,7 @@ curl -X 'POST' \
- - - - - - - - - - - - - - - - - - - - + @@ -195,12 +167,12 @@ curl -X 'POST' \ - + - - + + diff --git a/v2.2.x/site/en/userGuide/manage_collections.md b/v2.2.x/site/en/userGuide/manage_collections.md deleted file mode 100644 index 51071bf4f..000000000 --- a/v2.2.x/site/en/userGuide/manage_collections.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -id: manage_collections.md -title: Manage Collections ---- - -# Manage Collections - -A Milvus collection is similar to a table in traditional databases and is used to store and manage data. Learn about the collection-level operations. - -- [Create a Collection](create_collection.md): Create a collection with the book collection example. - -- [Check Collection Information](check_collection.md): Check the basic information of a collection in Milvus including its name, number of entities, and more. - -- [Drop a Collection](drop_collection.md): Caution is needed as the delete operation irreversibly drops the collection and all data within it. - -- [Manage Collection Alias](collection_alias.md): Milvus supports specifying a unique alias for a collection. - -- [Load a Collection](load_collection.md): Load the collection to memory before a search or a query. Milvus 2.1 now supports loading a collection as multiple replicas. - -- [Release a Collection](release_collection.md): Release a collection from memory after a search or a query to reduce memory usage. diff --git a/v2.2.x/site/en/userGuide/manage_connection.md b/v2.2.x/site/en/userGuide/manage_connection.md index 0b826c913..29676133b 100644 --- a/v2.2.x/site/en/userGuide/manage_connection.md +++ b/v2.2.x/site/en/userGuide/manage_connection.md @@ -29,6 +29,7 @@ Construct a Milvus connection. Ensure to connect to Milvus server before any ope JavaGONode.js + C# ```python @@ -71,13 +72,8 @@ final MilvusServiceClient milvusClient = new MilvusServiceClient( ); ``` -```shell -connect -h localhost -p 19530 -a default -``` - -```curl -curl localhost:9091/api/v1/health -{"status":"ok"} +```csharp +var milvusClient = new MilvusClient("localhost", username: "username", password: "password"); ```
Parameter
collection_namecollectionName Name of the collection to load partitions from.
partition_namesList of names of the partitions to load.partitionName / partitionNamesName of partition to load or name list of the partitions to load.
replica_number (optional)
@@ -176,35 +172,33 @@ curl localhost:9091/api/v1/health
- +
- + - + - - + + - + - +
OptionParameter Description
-h (Optional)host The host name. The default is "127.0.0.1".
-p (Optional)The port number. The default is "19530".portThe port number. The default is 19530.
-a (Optional)username The alias name of the Milvus link. The default is "default".
-D (Optional)password Flag to disconnect from the Milvus server specified by an alias. The default alias is "default".
-
- ### Return A Milvus connection created by the passed parameters. @@ -228,6 +222,7 @@ Disconnect from a Milvus server. Java GO Node.js + C#
```python @@ -246,12 +241,8 @@ milvusClient.Close() milvusClient.close() ``` -```shell -connect -D -``` - -```curl -# Close your HTTP client connection. +```csharp +milvusClient.Dispose(); ``` diff --git a/v2.2.x/site/en/userGuide/manage_data.md b/v2.2.x/site/en/userGuide/manage_data.md deleted file mode 100644 index b5b91a5f0..000000000 --- a/v2.2.x/site/en/userGuide/manage_data.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: manage_data.md -title: Manage Data ---- - -# Manage Data - -Data in Milvus are called entities. An entity consists of a group of fields and is used to represent unstructured data like images, magazine articles, short videos, and more. - -- [Insert Data](insert_data.md): Prepare and insert entities into Milvus. Milvus 2.1 now supports VARCHAR data type on scalar field. - -- [Delete Data](delete_data.md): Milvus supports deleting entities by primary key filtered with boolean expression. - -- [Compact Data](compact_data.md): Milvus supports automatic data compaction by default. You can still compact data manually and check the compaction status. diff --git a/v2.2.x/site/en/userGuide/manage_indexes.md b/v2.2.x/site/en/userGuide/manage_indexes.md deleted file mode 100644 index ce535926d..000000000 --- a/v2.2.x/site/en/userGuide/manage_indexes.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -id: manage_indexes.md -title: Manage Indexes ---- - -# Manage Indexes - -Indexing is the process of efficiently organizing data, and it plays a major role in making similarity search useful by dramatically accelerating time-consuming queries on large datasets. - -- [Build an Index](build_index.md): Build an index to accelerate your vector similarity search. Milvus 2.1 now supports indexes on the scalar field. - -- [Drop an Index](drop_index.md): Dropping an index irreversibly removes all corresponding index files. diff --git a/v2.2.x/site/en/userGuide/manage_partitions.md b/v2.2.x/site/en/userGuide/manage_partitions.md deleted file mode 100644 index a0326d746..000000000 --- a/v2.2.x/site/en/userGuide/manage_partitions.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -id: manage_partitions.md -title: Manage Partitions ---- - -# Manage Partitions - -A partition is a division of a collection. Milvus supports dividing collection data into multiple parts on physical storage so that search and other operations can be limited to one partition to improve performance. Learn about the partition-level operations. - -- [Create a Partition](create_partition.md): Create a partition with the example of creating a novel partition within a book collection. - -- [Check Partition Information](check_partition.md): Check the basic information of a partition in Milvus including its name. - -- [Drop a Partition](drop_partition.md): Caution is needed as the delete operation irreversibly drops the partition and all data within it. - -- [Load a Partition](load_partition.md): Load the partition to memory before a search or a query instead of loading the whole collection can significantly reduce memory usage. Milvus 2.1 now supports loading a partition as multiple replicas. - -- [Release a Partition](release_partition.md): Release a partition from memory after a search or a query to reduce memory usage. diff --git a/v2.2.x/site/en/userGuide/modify_collection.md b/v2.2.x/site/en/userGuide/modify_collection.md index a23b8cf94..39e495e24 100644 --- a/v2.2.x/site/en/userGuide/modify_collection.md +++ b/v2.2.x/site/en/userGuide/modify_collection.md @@ -10,10 +10,27 @@ This topic describes how to modify the properties, especially the time to live ( Currently, the TTL feature is only available in Python. -``` +
+ Python + Java + GO +
+ +```python +collection = Collection("books") collection.set_properties(properties={"collection.ttl.seconds": 1800}) ``` +```java +AlterCollectionParam alterCollectionParam = AlterCollectionParam.newBuilder + .withCollectionName("books") + .withTTL(1800) +``` + +```go +client.AlterCollection(context.Background(), "books", entity.CollectionTTL(1800)) +``` + The example above changes the collection TTL to 1800 seconds. | Parameter | Description | Option | diff --git a/v2.2.x/site/en/userGuide/release_partition.md b/v2.2.x/site/en/userGuide/release_partition.md index 3bb564668..c9bac6825 100644 --- a/v2.2.x/site/en/userGuide/release_partition.md +++ b/v2.2.x/site/en/userGuide/release_partition.md @@ -8,12 +8,12 @@ summary: Learn how to release a partition into memory for search or query in Mil This topic describes how to release a partition from memory after a search or a query to reduce memory usage. - ```python @@ -51,26 +51,15 @@ milvusClient.releasePartitions( ); ``` -
- -```shell -release -c book -p novel +```csharp +await milvusClient.GetCollection("book").ReleasePartitionAsync("novel"); +// You can release a set of partititons as follows: +// await milvusClient.GetCollection("book").ReleasePartitionsAsync(partitionNames: new List { +// "novel", +// "history" +// }) ``` -``` curl -curl -X 'DELETE' \ - 'http://localhost:9091/api/v1/partitions/load' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book", - "partition_names": ["novel"], - "replica_number": 1 - }' -``` - -
-
@@ -147,26 +136,7 @@ curl -X 'DELETE' \
- - - - - - - - - - - - - - - - - - - - + @@ -175,12 +145,12 @@ curl -X 'DELETE' \ - + - - + +
Parameter
collection_namecollectionName Name of the collection to release partitions.
partition_namesList of names of the partitions to release.partitionName / partitionNamesName of a partition or name list of the partitions to release.
diff --git a/v2.2.x/site/en/userGuide/rename_collection.md b/v2.2.x/site/en/userGuide/rename_collection.md index d9f65b12b..24d425ca1 100644 --- a/v2.2.x/site/en/userGuide/rename_collection.md +++ b/v2.2.x/site/en/userGuide/rename_collection.md @@ -10,17 +10,54 @@ If you want to rename a collection, you can use the collection-renaming API to i In the following code snippet, we create a collection and name it `old_collection`. Then we rename it `new_collection`. +
+ Python + Java + Go + Node.js + C# +
+ ```python -from pymilvus import Collection, FieldSchema, CollectionSchema, DataType, connections, utility -connections.connect(alias="default") -schema = CollectionSchema(fields=[ -... FieldSchema("int64", DataType.INT64, description="int64", is_primary=True), -... FieldSchema("float_vector", DataType.FLOAT_VECTOR, is_primary=False, dim=128), -... ]) +from pymilvus import Collection, utility + collection = Collection(name="old_collection", schema=schema) -utility.rename_collection("old_collection", "new_collection") # Output: True -utility.drop_collection("new_collection") -utility.has_collection("new_collection") # Output: False +utility.rename_collection("old_collection", "new_collection") +``` + +```java +import io.milvus.client.*; +import io.milvus.param.*; + +RenameCollectionParam renameCollectionParam = new RenameCollectionParam.newBuilder() + .withOldCollectionName("old_collection") + .withNewCollectionName("new_collection") + .build(); + +milvusClient.renameCollection(renameCollectionParam); +``` + +```go +// Not available yet +``` + +```javascript +const { MilvusClient } = require('@zilliz/milvus2-sdk-node'); + +const client = new MilvusClient({ address, username, password }); + +client.renameCollection({ + collection_name: "old_collection", + new_collection_name: "new_collection" +}).then(res => { + console.log(res); +}) +``` + +```csharp +using Milvus.Client; + +var collection = milvusClient.GetCollection("old_collection").RenameAsync("new_collection"); ``` For code examples in the flavor of other programming languages, keep watching. diff --git a/v2.2.x/site/en/userGuide/search/hybridsearch.md b/v2.2.x/site/en/userGuide/search/hybridsearch.md index 09472e786..7752c7ac5 100644 --- a/v2.2.x/site/en/userGuide/search/hybridsearch.md +++ b/v2.2.x/site/en/userGuide/search/hybridsearch.md @@ -22,6 +22,7 @@ All search and query operations within Milvus are executed in memory. Load the c Java GO Node.js + C# ```python @@ -55,16 +56,10 @@ milvusClient.loadCollection( ); ``` -
-```shell -load -c book +```csharp +var collection = milvusClient.GetCollection("book").LoadAsync(); ``` -```curl -# See the following step. -``` -
- ## Conduct a hybrid vector search By specifying the boolean expression, you can filter the scalar field of the entities during the vector search. The following example limits the scale of search to the vectors within a specified `word_count` value range. @@ -76,6 +71,7 @@ You can also use dynamic fields in the filter expression and output fields in th Java GO Node.js + C# ```python @@ -155,81 +151,22 @@ SearchParam searchParam = SearchParam.newBuilder() R respSearch = milvusClient.search(searchParam); ``` -
-```shell -search - -Collection name (book): book - -The vectors of search data(the length of data is number of query (nq), the dim of every vector in data must be equal to vector field’s of collection. You can also import a csv file without headers): [[0.1, 0.2]] - -The vector field used to search of collection (book_intro): book_intro - -Metric type: L2 - -Search parameter nprobe's value: 10 - -The max number of returned record, also known as topk: 2 - -The boolean expression used to filter attribute []: word_count <= 11000 - -The names of partitions to search (split by "," if multiple) ['_default'] []: - -timeout []: - -Guarantee Timestamp(It instructs Milvus to see all operations performed before a provided timestamp. If no such timestamp is provided, then Milvus will search all operations performed to date) [0]: - -Travel Timestamp(Specify a timestamp in a search to get results based on a data view) [0]: -``` - -```curl -curl -X 'POST' \ - 'http://localhost:9091/api/v1/search' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book", - "output_fields": ["book_id"], - "search_params": [ - {"key": "anns_field", "value": "book_intro"}, - {"key": "topk", "value": "2"}, - {"key": "params", "value": "{\"nprobe\": 10}"}, - {"key": "metric_type", "value": "L2"}, - {"key": "round_decimal", "value": "-1"} - ], - "vectors": [ [0.1,0.2] ], - "dsl": "word_count >= 11000", - "dsl_type": 1 - }' -``` - -
-Output: - -```json -{ - "status":{}, - "results":{ - "num_queries":1, - "top_k":2, - "fields_data":[ - { - "type":5, - "field_name":"book_id", - "Field":{"Scalars":{"Data":{"LongData":{"data":[11,12]}}}}, - "field_id":100 - } - ], - "scores":[119.44999,142.24998], - "ids":{"IdField":{"IntId":{"data":[11,12]}}},"topks":[2] - }, - "collection_name":"book" -} +```csharp +var results = await milvusClient.GetCollection("book").SearchAsync( + vectorFieldName: "book_intro", + vectors: new ReadOnlyMemory[] { new[] { 0.1f, 0.2f } }, + SimilarityMetricType.L2, + limit: 10, + new SearchParameters + { + OutputFields = { "title" }, + ConsistencyLevel = ConsistencyLevel.Strong, + Offset = 5, + Expression = "word_count <= 11000", + ExtraParameters = { ["nprobe"] = "1024" } + }); ``` -
-
- @@ -461,73 +398,47 @@ Output:
- + - - + - - - + + + + + + + + + + + + + + + + + +
OptionFull nameParameter Description
--helpn/aDisplays help for using the command.OutputFieldsA dictionary of the fields in the search results.
ConsistencyLevelConsistency level for the search. Possible values are:
    +
  • ConsistencyLevel.Strong
  • +
  • ConsistencyLevel.Session
  • +
  • ConsistencyLevel.BoundedStaleness
  • +
  • ConsistencyLevel.Eventually
  • +
  • ConsistencyLevel.Customized
  • +
OffsetNumber of records to skip before return. The sum of this value and limit in the search request should be less than 16384.
ExpressionBoolean expression used to filter attribute. See Boolean Expression Rules for more information.
ExtraParametersOther applicable parameters. See Vector Index for more information. Possible options are as follows:
    +
  • nprobe Indicates the number of cluster units to search. This parameter is available only when index_type is set to IVF_FLAT, IVF_SQ8, or IVF_PQ. The value should be less than nlist specified for the index-building process.
  • +
  • ef Indicates the search scope. This parameter is available only when index_type is set to HNSW. The value should be within the range from top_k to 32768.
  • +
  • search_k Indicates the search scope. This parameter is available only when index_type is set to ANNOY. The value should be greater than or equal to the top K.
  • +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Check the returned results.
@@ -535,6 +446,7 @@ Check the returned results. Java GO Node.js + C#
```python @@ -563,16 +475,16 @@ System.out.println(wrapperSearch.getIDScore(0)); System.out.println(wrapperSearch.getFieldData("book_id", 0)); ``` -
- -```shell -# Milvus CLI automatically returns the primary key values of the most similar vectors and their distances. -``` +```csharp +// # get the IDs of all returned hits +Console.WriteLine(results.Ids.LongIds) +// alternative Console.WriteLine(results.Ids.StringIds) -```curl -# See the output of the previous step. +// get the scores to the query vector from all returned hits +foreach (var score in results.Scores.ToList()) { + Console.WriteLine(score); +}; ``` -
## What's next diff --git a/v2.2.x/site/en/userGuide/search/query.md b/v2.2.x/site/en/userGuide/search/query.md index bfe9e85c7..86f9f22d4 100644 --- a/v2.2.x/site/en/userGuide/search/query.md +++ b/v2.2.x/site/en/userGuide/search/query.md @@ -22,6 +22,7 @@ All search and query operations within Milvus are executed in memory. Load the c Java GO Node.js + C# ```python @@ -54,20 +55,11 @@ milvusClient.loadCollection( .build() ); ``` -
-```shell -load -c book -``` - -
- -```curl -# See the following step. +```csharp +var collection = milvusClient.GetCollection("book").LoadAsync(); ``` - - ## Conduct a vector query The following example filters the vectors with certain `book_id` values, and returns the `book_id` field and `book_intro` of the results. @@ -81,6 +73,7 @@ You can also use dynamic fields in the filter expression and output fields in th Java GO Node.js + C# Curl @@ -137,24 +130,17 @@ QueryParam queryParam = QueryParam.newBuilder() R respQuery = milvusClient.query(queryParam); ``` -
- -```shell -query - -collection_name: book - -The query expression: book_id in [2,4,6,8] - -Name of partitions that contain entities(split by "," if multiple) []: - -A list of fields to return(split by "," if multiple) []: book_id, book_intro - -timeout []: +```csharp +var results = await Client.GetCollection("book").QueryAsync( + expression: "book_id in [2,4,6,8]", + new QueryParameters + { + Offset = 0, + Limit = 10, + OutputFields = { "book_id", "book_intro" } + }); ``` -
- ```curl curl --request POST \ --url '${MILVUS_HOST}:${MILVUS_PORT}/v1/vector/query' \ @@ -336,19 +322,25 @@ Output: - + - - + - - - + + + + + +
OptionFull nameParameter Description
--helpn/aDisplays help for using the command.expressionBoolean expression used to filter attribute. See Boolean Expression Rules for more information.
parametersQuery parameters. Possible options are:
    +
  • OutputFields: A dictionary of the fields in the search results.
  • +
  • Offset: Number of records to skip before return. The sum of this value and Limit should be less than 16384.
  • +
  • Limit: Number of records to return. The sum of this value and Offset should be less than 16384.
  • +
diff --git a/v2.2.x/site/en/userGuide/search/search.md b/v2.2.x/site/en/userGuide/search/search.md index 43bb82411..01d87d188 100644 --- a/v2.2.x/site/en/userGuide/search/search.md +++ b/v2.2.x/site/en/userGuide/search/search.md @@ -22,6 +22,7 @@ All search and query operations within Milvus are executed in memory. Load the c Java GO Node.js + C# ```python @@ -55,18 +56,8 @@ milvusClient.loadCollection( ); ``` -```shell -load -c book -``` - -```curl -curl -X 'POST' \ - 'http://localhost:9091/api/v1/collection/load' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book" - }' +```csharp +var collection = milvusClient.GetCollection("book").LoadAsync(); ``` ## Prepare search parameters @@ -78,6 +69,7 @@ Prepare the parameters that suit your search scenario. The following example def Java GO Node.js + C# Curl @@ -114,36 +106,16 @@ final Integer SEARCH_K = 2; // TopK final String SEARCH_PARAM = "{\"nprobe\":10, \"offset\":5}"; // Params ``` -
- -```shell -search - -Collection name (book): book - -The vectors of search data(the length of data is number of query (nq), the dim of every vector in data must be equal to vector field’s of collection. You can also import a csv file without headers): [[0.1, 0.2]] - -The vector field used to search of collection (book_intro): book_intro - -Metric type: L2 - -Search parameter nprobe's value: 10 - -The max number of returned record, also known as topk: 10 - -The boolean expression used to filter attribute []: - -The names of partitions to search (split by "," if multiple) ['_default'] []: - -timeout []: - -Guarantee Timestamp(It instructs Milvus to see all operations performed before a provided timestamp. If no such timestamp is provided, then Milvus will search all operations performed to date) [0]: - -Travel Timestamp(Specify a timestamp in a search to get results based on a data view) [0]: +```csharp +var parameters = new SearchParameters +{ + OutputFields = { "title" }, + ConsistencyLevel = ConsistencyLevel.Strong, + Offset = 5, + ExtraParameters = { ["nprobe"] = "1024" } +}; ``` -
- ```curl # Search entities based on a given vector. curl --request POST \ @@ -309,19 +281,43 @@ Output: - + - - + - - - + + + + + + + + + + + + + + + + + +
OptionFull nameParameter Description
--helpn/aDisplays help for using the command.OutputFieldsA dictionary of the fields in the search results.
ConsistencyLevelConsistency level for the search. Possible values are:
    +
  • ConsistencyLevel.Strong
  • +
  • ConsistencyLevel.Session
  • +
  • ConsistencyLevel.BoundedStaleness
  • +
  • ConsistencyLevel.Eventually
  • +
  • ConsistencyLevel.Customized
  • +
OffsetNumber of records to skip before return. The sum of this value and limit in the search request should be less than 16384.
ExpressionBoolean expression used to filter attribute. See Boolean Expression Rules for more information.
ExtraParametersOther applicable parameters. See Vector Index for more information. Possible options are as follows:
    +
  • nprobe Indicates the number of cluster units to search. This parameter is available only when index_type is set to IVF_FLAT, IVF_SQ8, or IVF_PQ. The value should be less than nlist specified for the index-building process.
  • +
  • ef Indicates the search scope. This parameter is available only when index_type is set to HNSW. The value should be within the range from top_k to 32768.
  • +
  • search_k Indicates the search scope. This parameter is available only when index_type is set to ANNOY. The value should be greater than or equal to the top K.
  • +
@@ -372,6 +368,7 @@ Milvus supports setting consistency level specifically for a search. The example Java GO Node.js + C# Curl @@ -451,8 +448,14 @@ SearchParam searchParam = SearchParam.newBuilder() R respSearch = milvusClient.search(searchParam); ``` -```shell -# Follow the previous step. +```csharp +var results = await milvusClient.GetCollection("book").SearchAsync( + vectorFieldName: "book_intro", + vectors: new ReadOnlyMemory[] { new[] { 0.1f, 0.2f } }, + SimilarityMetricType.L2, + // the sum of `offset` in `parameters` and `limit` should be less than 16384. + limit: 10, + parameters); ``` ```curl @@ -650,6 +653,43 @@ R respSearch = milvusClient.search(searchParam); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ParameterDescriptionOptions
collectionNameName of the collection to load.N/A
metricTypeMetric type used for search.This parameter must be set identical to the metric type used for index building.
vectorsVectors to search with.N/A
vectorFieldNameName of the field to search on.N/A
limitNumber of records to return.N/A
+ Check the primary key values of the most similar vectors and their distances.
@@ -657,6 +697,7 @@ Check the primary key values of the most similar vectors and their distances. Java GO Node.js + C#
```python @@ -682,8 +723,15 @@ System.out.println(wrapperSearch.getIDScore(0)); System.out.println(wrapperSearch.getFieldData("book_id", 0)); ``` -```shell -# Milvus CLI automatically returns the primary key values of the most similar vectors and their distances. +```csharp +// # get the IDs of all returned hits +Console.WriteLine(results.Ids.LongIds) +// alternative Console.WriteLine(results.Ids.StringIds) + +// get the scores to the query vector from all returned hits +foreach (var score in results.Scores.ToList()) { + Console.WriteLine(score); +}; ``` Release the collection loaded in Milvus to reduce memory consumption when the search is completed. @@ -693,6 +741,7 @@ Release the collection loaded in Milvus to reduce memory consumption when the se Java GO Node.js + C# ```python @@ -720,19 +769,9 @@ milvusClient.releaseCollection( .build()); ``` -```shell -release -c book -``` - -``` curl -curl -X 'DELETE' \ - 'http://localhost:9091/api/v1/collection/load' \ - -H 'accept: application/json' \ - -H 'Content-Type: application/json' \ - -d '{ - "collection_name": "book" - }' -``` +```csharp +var collection = milvusClient.GetCollection("book").ReleaseAsync(); +`` ## Limits |Feature|Maximum limit|