文档

单节点快速入门

更新时间:
重要

本文中含有需要您注意的重要提示信息,忽略该信息可能对您的业务造成影响,请务必仔细阅读。

本文为您介绍如何购买OpenSearch向量检索版单节点实例。

购买实例

  1. 进入OpenSearch控制台,在左上角切换到OpenSearch-向量检索版:然后在实例列表界面,单击创建实例image.png

  2. 商品版本选择向量检索版,选择地区,配置“数据节点数量”、“数据节点规格”、“单数据节点总存储空间”,设置“专有网络”和“虚拟交换机”,最后按提示要求设置用户名和用户密码(用于查询时校验权限,非阿里云账号密码),单击“立即购买”:image.png

    说明
    • 购买的数据节点的个数及规格,需根据自身业务进行规划,确定规格后实际费用可在售卖页自动生成。

    • 单节点方案,可不购买查询节点(即查询节点数量为0),查询节点规格族不生效。

    • 专有网络和虚拟交换的配置一定要和访问向量检索版实例的ECS机器保持一致。否则在访问向量检索版实例时会报错{'errors':{'code':'403','message':'Forbidden'}}。

    • 数据节点规格族SSD盘有50G的免费额度,额外额度按步长50GB收费;云盘型无免费额度,额度按步长50GB收费。

  3. 确认订单界面,查看服务协议,确认无误后,单击立即开通image.png

  4. 购买成功后,单击管理控制台,即可在实例列表界面查看已购买的向量检索版实例:image.png

配置实例

新购买的实例,在其详情页中,实例状态为“待配置”,并且会自动部署一个与购买的数据节点的个数及规格一致的空实例,之后需要为该实例配置表信息>数据同步>字段配置>索引结构,之后等待索引重建完成即可正常搜索。

image.png

1. 表基础信息

表管理单击“添加表",输入表名称,设置数据分片数数据更新资源数,选择需要的场景模板,单击下一步:

image.png

配置说明

  • 表名称:可自定义。

  • 数据分片数:由于是单节点实例,固定默认值为1,不可变更;当前实例仅支持单分片方案,可通过扩容支持多节点,详情可见扩缩容文档

  • 数据更新资源数:数据更新所用资源数,每个索引默认免费提供2个4核8G的更新资源,超出免费额度的资源将产生费用,详情可参考向量检索版计费概述

  • 场景模板:向量检索版内置了3种模板可供用户选择:通用、向量-图片搜索、向量-文本语义模板。

2. 数据同步

配置数据源(目前支持的数据源有OSS、MaxCompute数据源和API推送数据源),这里以MaxCompute数据源为例,数据源类型选择MaxCompute,设置Project、AccesskeyID、AccesskeySecret、Table、分组键partition、时间戳,可按需选择是否开启“自动索引重建”选择完成之后可选择校验,通过后可单击下一步:

image.png

3. 字段配置

OpenSearch会根据您选择的场景模板,预置相关字段,并会将全量数据来源中的字段(如有),自动导入字段列表中:

image.png

设置字段,必须包含至少两个字段,主键字段向量字段(向量字段需要设置为多值float类型):

image.png

如果需要带有命名空间的向量,可以在主键和向量字段中间加一个命名空间字段。

字段配置说明:

  • 必选字段:主键字段和向量字段,主键字段为int或string类型并且需要勾选主键按钮,向量字段为float类型并且需要勾选向量字段按钮;

  • 向量字段默认为多值的float类型,多值分隔符默认使用系统默认分割符^] 进行切分(其对应utf编码为\x1D),也可以输入自定义多值分隔符

  • 使用向量检索,在定义字段时有位置要求,需要按照主键字段、命名空间字段(非必要)、向量字段的顺序创建。(如上图所示)

4. 索引结构

4.1. 向量索引

OpenSearch会对主键与向量字段自动构建索引,索引名与字段名相同,只需要在控制台配置向量索引:

image.png

高级配置,向量索引需要单独配置参数,详情可参考向量索引通用配置

说明
  • 主键字段、向量字段必须填写,命名空间字段非必填,可以为空。

  • 仅支持选择固定的三个字段,不支持新增。

  • 系统自动填充向量索引的配置参数,如无特殊需求,可直接单击「下一步」快速完成配置。

  • 命名空间字段:实例引擎版本为vetcor service 1.0.2及以下版本,namespace标签字段不支持string格式类型;实例引擎版本为vetcor service 1.0.2及以上版本,无此限制。

5. 确认创建

索引配置完成后,单击「确认创建」;可以看到表状态在创建中,如下图所示。

image.png

image.png

6. 变更历史

实例管理-变更历史,可以看到近3天、7天、30天变更记录,例如:创建表、新增索引、扩容及全量的所有流程,如下截图时创建表的过程;全部完成之后引擎搭建完成,可以开始查询测试:

image

7. 查询测试

查询示例

{
  "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:具体要查询的向量

  • topK:取top K个结果

  • 是否返回文档中的向量信息

结果演示

image.png

详细的查询语法可参考下文的语法说明。

语法说明

SDK中使用向量检索

单节点升级多节点

如果需要将一个单节点,升级多节点,可参考下面操作:

警告

单节点升级多节点变更期间实例不可用,具体变更进度可在变更历史页中查看相应的流程进度:

image

  1. 在“实例列表”界面,实例列表页中找到对应的实例,在右侧“操作”栏中单击"扩/缩容":image.png

  2. 在变配页中选择具体需要扩/缩容的查询节点数量、规格,和勾选“服务协议”后单击立即购买即可。

image.png

  • 本页导读 (0)