当前位置: 首页 > news >正文

潮州seo网站推广站群cms网站系统

潮州seo网站推广,站群cms网站系统,网址缩短链接,品牌网站建设策划方案本文介绍如何通过HTTP API向Collection中插入或更新Doc。 说明 若调用本接口时Doc Id已存在,则等同于更新Doc;Doc Id不存在,则等同于插入Doc。 若调用本接口时不指定Doc Id,则等同于插入Doc,DashVector会自动生成Doc …

本文介绍如何通过HTTP API向Collection中插入或更新Doc。


说明

  1. 若调用本接口时Doc Id已存在,则等同于更新Doc;Doc Id不存在,则等同于插入Doc。

  2. 若调用本接口时不指定Doc Id,则等同于插入Doc,DashVector会自动生成Doc Id,并在返回结果中携带id信息。

前提条件

  • 已创建Cluster:创建Cluster。

  • 已获得API-KEY:API-KEY管理。

Method与URL

HTTP

POST https://{Endpoint}/v1/collections/{CollectionName}/docs/upsert

使用示例

说明

  1. 需要使用您的api-key替换示例中的YOUR_API_KEY、您的Cluster Endpoint替换示例中的YOUR_CLUSTER_ENDPOINT,代码才能正常运行。

  2. 本示例需要参考新建Collection-使用示例提前创建好名称为quickstart的Collection

插入或更新Doc

Shell

curl -XPOST \-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/upsert# example output:
# {"request_id":"1b8b4ada-1148-49ce-82e3-f7f521bb6f3b","code":0,"message":"Success","output":[{"doc_op":"insert","id":"1","code":0,"message":""}]}

插入或更新不带有Id的Doc

Shell

curl -XPOST \-H 'dashvector-auth-token: YOUR_API_KEY' \-H 'Content-Type: application/json' \-d '{"docs": [{"vector": [0.1, 0.2, 0.3, 0.4]}]}' https://YOUR_CLUSTER_ENDPOINT/v1/collections/quickstart/docs/upsert# example output:
# {"request_id":"9c3f2441-c47b-43a0-bb84-127ff6a88711","code":0,"message":"Success","output":[{"doc_op":"insert","id":"6176745980928","code":0,"message":""}]}

插入或更新带有Fields的Doc

Shell

curl -XPOST \-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/upsert# example output:
# {"request_id":"e1467d91-f4fd-4944-9ec0-1634de426db1","code":0,"message":"Success","output":[{"doc_op":"insert","id":"2","code":0,"message":""}]}

批量插入或更新Doc

Shell

curl -XPOST \-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/upsert# example output:
# {"request_id":"113d221b-ec79-4fde-b546-58db5154e49d","code":0,"message":"Success","output":[{"doc_op":"insert","id":"3","code":0,"message":""},{"doc_op":"insert","id":"4","code":0,"message":""},{"doc_op":"insert","id":"5","code":0,"message":""}]}

插入或更新带有Sparse Vector的Doc

Shell

curl -XPOST \-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/upsert# example output:
# {"request_id":"c401e51d-430e-4c49-9d07-c944ec94de7b","code":0,"message":"Success","output":[{"doc_op":"insert","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

返回插入或更新Doc的结果,DocOpResult列表

usage

map

对Serverless实例(按量付费)集合的Doc插入或更新请求,成功后返回实际消耗的写请求单元数

{Usage: {write_units: 4}
}
http://www.laogonggong.com/news/99786.html

相关文章:

  • 百度seo公司整站优化象山做网站
  • 舟山网站seo2019年建设什么网站好
  • 济南网站seo厂家单页面seo搜索引擎优化
  • app开发网站排行榜电商数据统计网站
  • wordpress多站版wordpress 女性主题
  • 网加思维做网站推广通辽大柒网站建设有限公司
  • 做网站有什么建议网站如何做视频教程
  • 网站后台更新了 前台不现实拼多多关键词优化是怎么弄的
  • 重构网站单页营销式网站模板
  • 即墨专业医院网站制作公司青岛网页搜索排名提升
  • 计算机网络技术吃香吗快速优化seo软件
  • 学院网站建设 需求分析点了网站域名会跳转
  • 广州建设培训网站在线图片编辑器马赛克
  • 广东微信网站制作公司哪家好快速建设企业网站
  • 视频网站设计论文网页设计与网站建设题库
  • 做微网站用什么框架服装定制网站的设计与实现
  • 怎么建公司免费网站网站开发的有关公司
  • icp许可证对网站的要求.net电子商务网站开发
  • 网站建设怎么做更好网站内页301重定向
  • 饮料网站模板重庆建设造价信息网站
  • 临沂罗庄建设局网站新网站建设咨询
  • 有没有专门做京东天猫的人才网站贺州seo
  • 平阴县建设局网站什么是企业网站策划案
  • 网站升级正在升级维护起公司名称大全免费网站
  • 开发区网站建设工作职责对比插件 wordpress
  • 马鞍山做网站公司为什么要给大夫做网站
  • 自己开一个网站怎么赚钱精美网页布局
  • 南昌专业网站建设卸载wordpress主题
  • 南京网站设计公司排名小程序开发 上海
  • 嘉兴专业的嘉兴专业网站建设项目局域网网页制作