-```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" }
+ });
```
-
-
-
+
- Option |
- Full name |
+ Parameter |
Description |
- --help |
- n/a |
- Displays help for using the command. |
+ OutputFields |
+ A dictionary of the fields in the search results. |
+
+
+ ConsistencyLevel |
+ Consistency level for the search. Possible values are:
+ - ConsistencyLevel.Strong
+ - ConsistencyLevel.Session
+ - ConsistencyLevel.BoundedStaleness
+ - ConsistencyLevel.Eventually
+ - ConsistencyLevel.Customized
+ |
+
+
+ Offset |
+ Number of records to skip before return. The sum of this value and limit in the search request should be less than 16384 . |
+
+
+ Expression |
+ Boolean expression used to filter attribute. See Boolean Expression Rules for more information. |
+
+
+ ExtraParameters |
+ Other 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.
+ |
-
-
-
- Parameter |
- Description |
-
-
-
-
- output_fields (optional) |
- Name of the field to return. Vector field is not supported in current release. |
-
-
- anns_field |
- Name of the field to search on. |
-
-
- topk |
- Number of the most similar results to return. |
-
-
- params |
- Search parameter(s) specific to the index. See Vector Index for more information. |
-
-
- metric_type |
- Metric type used for search. This parameter must be set identical to the metric type used for index building. |
-
-
- round_decimal (optional) |
- Number of decimal places of returned distance. |
-
-
- Vectors |
- Vectors to search with. |
-
-
- dsl |
- Boolean expression used to filter attribute. Find more expression details in Boolean Expression Rules. |
-
-
- dsl_type |
- Type of dsl (Data Search Language) field:
- 0: "Dsl"
- 1: "BoolExprV1"
- |
-
-
-
-
Check the returned results.
```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:
-
+
- Option |
- Full name |
+ Parameter |
Description |
- --help |
- n/a |
- Displays help for using the command. |
+ expression |
+ Boolean expression used to filter attribute. See Boolean Expression Rules for more information. |
+
+
+ parameters |
+ Query 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:
-