

# 将 S3 Vectors 与 OpenSearch Service 结合使用
<a name="s3-vectors-opensearch"></a>

Amazon S3 Vectors 与 OpenSearch 集成，以提供灵活的向量存储和搜索功能。这种集成可让您通过在 S3 Vectors 中存储向量来优化成本，同时利用 OpenSearch 的高级搜索功能。

S3 Vectors 和 OpenSearch 之间有两种集成。一种是将向量数据从 S3 Vectors 导出到 OpenSearch 无服务器，以获得高性能的搜索功能。另一种使用 S3 Vectors 作为 OpenSearch 中经济高效的存储引擎，同时保持对 OpenSearch 功能的访问权限。

## 导出到 OpenSearch 无服务器
<a name="s3-vectors-opensearch-export"></a>

可以将向量索引从 S3 Vectors 导出到 OpenSearch 无服务器集合，以实现高性能搜索操作、混合搜索、聚合、高级筛选和分面搜索。导出时，数据会复制到 OpenSearch 无服务器，同时保留在 S3 Vectors 中，这意味着在这段时间内，您需要为这两项服务付费。

### 何时使用此集成
<a name="s3-vectors-opensearch-export-when"></a>

当您需要以下功能时，可以考虑从 S3 Vectors 导出到 OpenSearch 无服务器：
+ **混合搜索功能**，该功能将向量相似性与关键字搜索相结合。
+ **高查询吞吐量**，适用于要求苛刻的工作负载。
+ **低延迟响应**，适用于需要毫秒级响应时间的实时应用程序。
+ **高级分析**，包括聚合、分面搜索和复杂的筛选。

### 先决条件
<a name="s3-vectors-opensearch-export-prereq"></a>

在将 S3 Vectors 与 OpenSearch 结合使用之前，请确保满足以下条件：
+ 一个现有 S3 向量存储桶，其向量索引包含您的数据。
+ 适用于 S3 Vectors 和 OpenSearch Service 的相应 IAM 权限。
+ 了解性能要求以选择适合的集成方法。

### 开始使用
<a name="s3-vectors-opensearch-export-getting-started"></a>

**使用 AWS 管理控制台**

**将向量数据导出到 OpenSearch**

1. 登录到 AWS 管理控制台，然后通过以下网址打开 Amazon S3 控制台：[https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)。

1. 在导航窗格中，选择**向量存储桶**。

1. 在向量存储桶列表中，选择存储桶的名称，该存储桶包含您要导出的向量数据。

1. 对于**向量索引**，选择要导出的向量索引旁边的单选按钮。

1. 选择**高级搜索导出**，然后选择**导出到 OpenSearch**。

**重要**  
**时间点导出**：导出将捕获开始导出之前的数据。如果在摄取到 OpenSearch 的过程中对向量数据做了更新，则并非所有更新都会反映在 OpenSearch 中。
**一次性操作**：这是一次性导出，而不与 S3 Vectors 数据保持同步。必须手动重新导出，才能捕获任何后续更改。

然后，要配置和管理 S3 Vectors 与 Amazon OpenSearch Service 的集成，将主要通过 OpenSearch 控制台进行操作。

**查看向 OpenSearch 导出的内容**

1. 登录到 AWS 管理控制台，然后通过以下网址打开 Amazon S3 控制台：[https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)。

1. 在导航窗格中，选择**向量存储桶**。

1. 在向量存储桶列表中，选择存储桶的名称，该存储桶包含您要导出的向量数据。

1. 对于**向量索引**，选择**高级搜索导出**，然后选择**查看向 OpenSearch 导出的内容**。

然后，将通过 OpenSearch 控制台查看向 OpenSearch 导出的内容。

有关创建和管理 OpenSearch 无服务器集合的更多信息，请参阅《Amazon OpenSearch Service Developer Guide》**中的 [Creating and managing Amazon OpenSearch Service Serverless collections](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-collections.html)。

## 使用 S3 Vectors 引擎的 OpenSearch
<a name="s3-vectors-opensearch-engine"></a>

可以使用 S3 Vectors 作为 [Amazon OpenSearch 托管集群](https://aws.amazon.com/opensearch-service/features/managed/)的底层存储引擎，提供成本优化的向量存储，同时维护 OpenSearch 功能。

### 何时使用此集成
<a name="s3-vectors-opensearch-engine-when"></a>

当您需要以下功能时，可以考虑将 OpenSearch 与 S3 Vectors 引擎结合使用：
+ **混合搜索功能**，该功能将向量相似性与关键字搜索相结合。
+ **较低的查询吞吐量**，使用模式可能不那么频繁或只是零星使用。
+ **较高的延迟容差**，适用于可以接受更长响应时间以换取成本节约的应用程序。
+ **高级分析**，包括聚合、分面搜索和复杂的筛选。
+ **现有 OpenSearch 工作流程**，您想要使用经济高效的向量存储对其进行扩展。

### 先决条件
<a name="s3-vectors-opensearch-engine-prereq"></a>

在将 OpenSearch 与 S3 Vectors 引擎结合使用之前，请确保满足以下条件：
+ 一个现有的 OpenSearch 托管域。有关更多信息，请参阅《Amazon OpenSearch Service 开发人员指南》**中的[创建和管理 Amazon OpenSearch Service 域](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/createupdatedomains.html)。
+ 了解性能要求以选择适合的集成方法。

### 开始使用
<a name="s3-vectors-opensearch-engine-getting-started"></a>

要将 OpenSearch 与 S3 Vectors 引擎结合使用，请在 OpenSearch 中创建索引期间将引擎设置为 `S3_Vectors`。有关在 OpenSearch Service 中创建索引时使用的模板的更多信息，包括在何处指定引擎类型，请参阅 [Methods and engines](https://docs.opensearch.org/docs/latest/field-types/supported-field-types/knn-methods-engines/)。有关 OpenSearch 和 S3 Vectors 引擎之间集成的更多信息，请参阅《Amazon OpenSearch Service Developer Guide》**中的 [Advanced search capabilities with an S3 Vectors engine](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/s3-vector-opensearch-integration-engine.html)。