メインコンテンツまでスキップ

コレクションへの関数の追加 (V2)

This operation adds a function to the schema of an existing collection.

POST/v2/vectordb/collections/add_function
接続エンドポイント

https://${CLUSTER_ENDPOINT}

📘ノート
  • ${CLUSTER_ENDPOINT} を、あなたのZilliz Cloudクラスターのエンドポイントに置き換える必要があります。
  • エンドポイントを取得するには、Describe Cluster V2 APIを使用してレスポンスから値を抽出してください。
shell
export CLUSTER_ENDPOINT=""
パラメータ
Authorizationstringheader必要

認証トークンは、適切な権限を持つAPIキー、またはコロンで結合されたユーザー名とパスワードのペア(例:username:password)である必要があります。プロジェクトエンドポイントを使用している場合は、十分な権限を持つ有効なAPIキーのみが適用されます。

値の例: Bearer {{TOKEN}}
リクエスト・ボディ
dbNamestring

データベースの名前。

collectionNamestring必要

コレクションの名前。

functionobject必要

関数スキーマオブジェクト。

namestring必要

作成する関数の名前。

descriptionstring

作成する関数の説明。

typestring必要

作成する関数のタイプ。

inputFieldNamesarray必要

作成する関数の入力フィールドの名前。

[]inputFieldNamesstring

フィールド名。

outputFieldNamesarray必要

作成する関数の出力フィールドの名前。

[]outputFieldNamesstring

フィールド名。

paramsobject

現在の関数に固有の設定パラメーター。関数タイプがFunctionType.BM25に設定されている場合、パラメーターは不要です。FunctionType.TEXTEMBEDDINGまたはFunctionType.RERANKタイプの関数に適用可能なパラメーターについては、Embedding FunctionsおよびReranking Functionsを参照してください。

bash
export TOKEN="db_admin:xxxxxxxxxxxxx"

curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/collections/add_function" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Request-Timeout: 5" \
--header "Content-Type: application/json" \
-d '{
"collectionName": "my_collection",
"function": {
"name": "bm25_fn",
"type": "FunctionType.BM25",
"inputFieldNames": [
"text"
],
"outputFieldNames": [
"sparse"
]
}
}'
レスポンス

なし

codeinteger

レスポンスコード。

dataobject

エラーメッセージを返します。

codeinteger

レスポンスコード。

messagestring

エラーメッセージ。

Successjson
{
"code": 0,
"data": {}
}
Ctrl I