用戶可通過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
}
]
相關查詢語法:
文檔內容是否對您有幫助?