Method: projects.locations.collections.dataObjects.batchSearch

批量搜索数据对象。

HTTP 请求

POST https://vectorsearch.googleapis.com/v1beta/{parent}/dataObjects:batchSearch

路径参数

参数
parent

string

必需。要搜索的集合的资源名称。格式:projects/{project}/locations/{location}/collections/{collection}

请求正文

请求正文中包含结构如下的数据:

JSON 表示法
{
  "searches": [
    {
      object (Search)
    }
  ],
  "combine": {
    object (CombineResultsOptions)
  }
}
字段
searches[]

object (Search)

必需。要并行执行的搜索请求列表。

combine

object (CombineResultsOptions)

可选。用于合并批量搜索操作结果的选项。

响应正文

批量搜索操作的响应。

如果成功,响应正文将包含结构如下的数据:

JSON 表示法
{
  "results": [
    {
      object (SearchDataObjectsResponse)
    }
  ]
}
字段
results[]

object (SearchDataObjectsResponse)

仅限输出。搜索响应列表,每个请求对应一个响应。如果使用排名器,则会返回单个排名结果列表。

授权范围

需要以下 OAuth 范围:

  • https://www.googleapis.com/auth/cloud-platform

如需了解详情,请参阅 Authentication Overview

IAM 权限

需要拥有 parent 资源的以下 IAM 权限:

  • vectorsearch.dataObjects.search

如需了解详情,请参阅 IAM 文档

CombineResultsOptions

用于合并批量搜索操作结果的选项。

JSON 表示法
{
  "ranker": {
    object (Ranker)
  },
  "outputFields": {
    object (OutputFields)
  },
  "topK": integer
}
字段
ranker

object (Ranker)

必需。用于合并结果的排名器。

outputFields

object (OutputFields)

可选。用于指定要返回的字段的掩码。

topK

integer

可选。要返回的结果的数量。如果未设置,系统将使用默认值。

Ranker

定义用于合并多个搜索结果的排名器。

JSON 表示法
{

  // Union field ranker can be only one of the following:
  "rrf": {
    object (ReciprocalRankFusion)
  }
  // End of list of possible types for union field ranker.

  // Union field reranker can be only one of the following:
  "vertexRanker": {
    object (VertexRanker)
  }
  // End of list of possible types for union field reranker.
}
字段
联合字段 ranker。要使用的排名方法。ranker 只能是下列其中一项:
rrf

object (ReciprocalRankFusion)

倒数排序融合排名。

联合字段 reranker。用于对排名器合并的结果进行最终排名的重排名器。reranker 只能是下列其中一项:
vertexRanker

object (VertexRanker)

可选。Vertex AI 排名。

ReciprocalRankFusion

定义用于结果排名的倒数排序融合 (RRF) 算法。

JSON 表示法
{
  "weights": [
    number
  ]
}
字段
weights[]

number

必需。在融合期间应用于每个搜索结果集的权重。

VertexRanker

定义使用 Vertex AI 排名服务的排名器。如需了解详情,请参阅 https://cloud.google.com/generative-ai-app-builder/docs/ranking

JSON 表示法
{
  "model": string,
  "topN": integer,

  // Union field record_spec can be only one of the following:
  "textRecordSpec": {
    object (TextRecordSpec)
  }
  // End of list of possible types for union field record_spec.
}
字段
model

string

必需。用于对文档进行排名的模型。如需查看可用模型列表,请参阅 https://docs.cloud.google.com/generative-ai-app-builder/docs/ranking#models。目前仅支持 semantic-ranker-fast@latest

topN

integer

必需。要处理以进行排名的文档数量。

联合字段 record_spec。用于排名的记录规范。必须至少设置一个记录规范。record_spec 只能是下列其中一项:
textRecordSpec

object (TextRecordSpec)

用于文本搜索的记录规范。

TextRecordSpec

用于文本搜索的记录规范。

JSON 表示法
{
  "query": string,
  "titleTemplate": string,
  "contentTemplate": string
}
字段
query

string

必需。用于对记录进行排名和评分的查询。

titleTemplate

string

可选。用于生成记录标题的模板。

contentTemplate

string

可选。用于生成记录内容的模板。