View a markdown version of this page

创建 GPU-accelerated 向量索引 - 亚马逊 OpenSearch 服务

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

创建 GPU-accelerated 向量索引

在您的域或集合 GPU-acceleration 上启用后,创建可以利用 GPU 处理的矢量索引。

注意

当您在 GPU-acceleration 启用的情况下创建域名时,该index.knn.remote_index_build.enabled设置为true默认设置。创建索引时无需明确设置此设置。对于集合,必须明确指定此设置的值。

Creating index with GPU-acceleration

以下示例创建了针对 GPU 处理进行了优化的矢量索引。该索引存储 768 维向量(通常用于文本嵌入)。

PUT my-vector-index { "settings": { "index.knn": true, "index.knn.remote_index_build.enabled": true }, "mappings": { "properties": { "vector_field": { "type": "knn_vector", "dimension": 768 }, "text": { "type": "text" } } } }

关键配置元素:

  • "index.knn": true-启用 k 最近邻功能

  • "index.knn.remote_index_build.enabled": true-为该索引启用 GPU 处理。当域已 GPU-acceleration 启用时,未指定此设置的默认为true。对于集合,必须明确指定此设置的值。

  • "dimension": 768-指定矢量大小(根据您的嵌入模型进行调整)

Creating index without GPU-acceleration

以下示例创建了一个禁用 GPU 处理的矢量索引。该索引存储 768 维向量(通常用于文本嵌入)。

PUT my-vector-index { "settings": { "index.knn": true, "index.knn.remote_index_build.enabled": false }, "mappings": { "properties": { "vector_field": { "type": "knn_vector", "dimension": 768 }, "text": { "type": "text" } } } }