日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

更新Doc

本文介紹如何通過HTTP API更新Collection中已存在的Doc。

說明
  1. 若更新Doc時指定id不存在,則本次更新Doc操作無效

  2. 如只更新部分屬性fields,其他未更新屬性fields默認被置為null

前提條件

Method與URL

PUT https://{Endpoint}/v1/collections/{CollectionName}/docs

使用示例

說明
  1. 需要使用您的api-key替換示例中的YOUR_API_KEY、您的Cluster Endpoint替換示例中的YOUR_CLUSTER_ENDPOINT,代碼才能正常運行。

  2. 本示例需要參考新建Collection-使用示例提前創建好名稱為quickstart的Collection

插入Doc

curl -XPUT \
  -H 'dashvector-auth-token: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "docs": [{"id": "1", "vector": [0.1, 0.2, 0.3, 0.4]}]
  }' https://YOUR_CLUSTER_ENDPOINT/v1/collections/quickstart/docs

# example output:
# {"request_id":"b1ce1b30-14a2-4e38-9931-f0b832660da9","code":0,"message":"Success","output":[{"doc_op":"update","id":"1","code":0,"message":""}]}

插入帶有Fields的Doc

curl -XPUT \
  -H 'dashvector-auth-token: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "docs": [
      {
      	"id": "2", 
        "vector": [0.2, 0.3, 0.4, 0.5], 
        "fields": 
          {
            "age": 70, 
            "name": "zhangshan",
            "anykey1": "str-value",
            "anykey2": 1,
            "anykey3": true,
            "anykey4": 3.1415926
          }
      }
    ]
   }' https://YOUR_CLUSTER_ENDPOINT/v1/collections/quickstart/docs

# example output:
# {"request_id":"0d22a37f-e906-4121-8408-7f1b685bb211","code":0,"message":"Success","output":[{"doc_op":"update","id":"2","code":0,"message":""}]}

批量插入Doc

curl -XPUT \
  -H 'dashvector-auth-token: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{ 
    "docs": [ 
      {"id": "3", "vector": [0.3, 0.4, 0.5, 0.6]},
      {"id": "4", "vector": [0.4, 0.5, 0.6, 0.7], "fields": {"age": 20, "name": "zhangsan"}},
      {"id": "5", "vector": [0.5, 0.6, 0.7, 0.8], "fields": {"anykey": "anyvalue"}}
    ]
   }' https://YOUR_CLUSTER_ENDPOINT/v1/collections/quickstart/docs

# example output:
# {"request_id":"d9a81bbc-7010-4902-a91c-7402e13143fa","code":0,"message":"Success","output":[{"doc_op":"update","id":"3","code":0,"message":""},{"doc_op":"update","id":"4","code":0,"message":""},{"doc_op":"update","id":"5","code":0,"message":""}]}

插入帶有Sparse Vector的Doc

curl -XPUT \
  -H 'dashvector-auth-token: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "docs": [
      {"id": "6", "vector": [0.1, 0.2, 0.3, 0.4], "sparse_vector":{"1":0.4, "10000":0.6, "222222":0.8}}
    ]
   }' https://YOUR_CLUSTER_ENDPOINT/v1/collections/quickstart/docs

# example output:
# {"request_id":"bb28479a-1a54-4d0b-a083-6399ac7bceeb","code":0,"message":"Success","output":[{"doc_op":"update","id":"6","code":0,"message":""}]}

入參描述

參數

Location

類型

必填

說明

{Endpoint}

path

str

Cluster的Endpoint,可在控制臺Cluster詳情中查看

{CollectionName}

path

str

Collection名稱

dashvector-auth-token

header

str

api-key

docs

body

array

待更新的Doc列表

partition

body

str

Partition名稱

出參描述

字段

類型

描述

示例

code

int

返回值,參考返回狀態碼說明

0

message

str

返回消息

success

request_id

str

請求唯一id

19215409-ea66-4db9-8764-26ce2eb5bb99

output

array

返回更新的結果,DocOpResult列表

usage

map

對Serverless實例(按量付費)集合的Doc更新請求,成功后返回實際消耗的寫請求單元數

{
    Usage: {
        write_units: 5
    }
}