Skip to main content
GET
Search Index for Documents

文档搜索索引

使用语义搜索来搜索索引中的文档。

端点

说明

使用语义搜索来搜索索引中的文档。返回具有相关性分数的匹配文档,并按相关性排序。

身份验证

必需:API 密钥

路径参数

查询参数

请求示例

JavaScript/Node.js

###Python

回应

成功响应 (200)

响应字段

结果对象

匹配对象

元数据对象

错误响应

400 错误请求

401 未经授权

403 禁止

404 未找到

500 内部服务器错误

注释

  • 语义搜索使用向量相似度来查找相关文档
  • 结果按相关性分数排序(最高的在前)
  • 使用min_score过滤掉低相关性结果
  • 内容预览被截断为 500 个字符
  • top_k 参数限制返回结果的数量
  • 元数据包括有关文档来源和位置的信息

授权

Authorization
string
header
必填

API key authentication using Bearer token format. Example: Authorization: Bearer sk-your-api-key-here

路径参数

indexName
string
必填

Name of the index to search

示例:

"my-knowledge-base"

查询参数

query
string
必填

Search query text

示例:

"What is machine learning?"

top_k
integer
默认值:10

Maximum number of results to return (1-50, default: 10)

必填范围: 1 <= x <= 50
示例:

10

min_score
number<float>
默认值:0

Minimum relevance score threshold (0.0-1.0, default: 0.0)

必填范围: 0 <= x <= 1
示例:

0.5

响应

Search completed successfully

success
boolean
示例:

true

request_id
string<uuid>
示例:

"550e8400-e29b-41d4-a716-446655440000"

query
string
示例:

"What is machine learning?"

results
object
index
object