用户可通过SDK或控制台查询测试页面查询表中数据
1、配置公网白名单
如果用户的访问环境是同个虚拟交换的VPC环境,可以忽略此步骤。
本地环境或公网环境请参考公网白名单配置。
2、查询表数据
SDK查询
这里以Python为例:
添加依赖:
pip install alibabacloud-ha3engine-vector
查询数据demo:
from alibabacloud_ha3engine_vector.client import Client
from alibabacloud_ha3engine_vector.models import Config
from alibabacloud_ha3engine_vector.models import QueryRequest
config = Config(
# 私网域名调用请填写endpoint
endpoint="<API域名>",
# 实例名称,可在实例详情页左上角查看,例:ha-cn-i7*****605
instance_id="<实例id>",
# 用户名,可在实例详情页>网络信息 查看
access_user_name="<用户名>",
# 密码,可在实例详情页>网络信息 修改
access_pass_word="<用户名密码>")
client = Client(config)
request = QueryRequest(table_name="<表名>",
vector=[0.1, 0.2, 0.3],
include_vector=True,
top_k=10)
result = client.query(request)
print(result.body)
其他查询SDK可参考查询数据。
说明
Python SDK中endpoint里需要去掉http://
相应结果示例:
{
"totalCount": 1,
"result": [
{
"id": "1",
"vector": [
0.0019676426891237499,
...
],
"score": 0.0
}
],
"totalTime": 2.688
}
控制台查询
在向量检索版控制台>【实例管理】>【查询测试】页面:
在查询测试页面选择对应的索引表进行查询:
示例:
{
"vector": [0.0019676427,0.005902928,0.021644069,0.21644068,0.12199384,0.043288138,0.007870571,0.0,0.08460863,0.041320495,0.043288138,0.035417568,0.011805856,0.055093993,0.12592913,0.017708784,0.021644069,0.0019676427,0.0,0.0,0.0019676427,0.078705706,0.1987319,0.041320495,0.039352853,0.0039352854,0.007870571,0.0039352854,0.0039352854,0.017708784,0.035417568,0.06886749,0.0019676427,0.0019676427,0.013773498,0.049191065,0.2125054,0.22824654,0.123961486,0.0039352854,0.0,0.0,0.021644069,0.14560555,0.078705706,0.1987319,0.22824654,0.005902928,0.064932205,0.0019676427,0.0019676427,0.021644069,0.027546996,0.035417568,0.22824654,0.22824654,0.1337997,0.023611711,0.009838213,0.007870571,0.0039352854,0.0039352854,0.017708784,0.20069954,0.033449925,0.005902928,0.019676426,0.035417568,0.015741142,0.029514639,0.13183205,0.123961486,0.029514639,0.0,0.027546996,0.22824654,0.15741141,0.0,0.0039352854,0.043288138,0.18889369,0.072802775,0.055093993,0.17315255,0.08460863,0.0019676427,0.007870571,0.035417568,0.22824654,0.10034977,0.009838213,0.021644069,0.062964566,0.027546996,0.015741142,0.04525578,0.086576276,0.033449925,0.023611711,0.017708784,0.0,0.0,0.03738521,0.072802775,0.16724962,0.035417568,0.031482283,0.20463483,0.043288138,0.011805856,0.0039352854,0.051158708,0.023611711,0.11412327,0.13183205,0.16134669,0.049191065,0.023611711,0.0039352854,0.0039352854,0.049191065,0.035417568,0.015741142,0.0039352854,0.03738521,0.08264099,0.094446845,0.021644069],
"topK": 10,
"includeVector": true
}
相应结果:
[
{
"vector": [
0.0019676426891237497,
0.0059029278345406055,
...
],
"id": "0",
"score": 0
}
]
相关查询语法: