

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

# 亚马逊 Neptune-to-OpenSearch复制
<a name="full-text-search-cfn-setup"></a>

Amazon Neptune 支持使用亚马逊服务（服务）在 Gremlin 和 SPARQL 查询中进行全文搜索。 OpenSearch OpenSearch 您可以使用 AWS CloudFormation 堆栈将 OpenSearch 服务域链接到 Neptune。该 CloudFormation 模板创建了一个提供 Neptune-to-OpenSearch复制功能的 Streams-Consumer 应用程序实例。

在开始之前，您需要一个启用了流的现有 Neptune 数据库集群作为源，并需要一个 OpenSearch 服务域作为复制目标。

如果您在 Neptune 数据库集群所在的 VPC 中已经有一个可以通过 Lambda 访问的现有目标 OpenSearch 服务域，则模板可以使用该服务域。否则，您需要创建一个新目标域。

**注意**  
您创建的 OpenSearch 集群和 Lambda 函数必须与您的 Neptune 数据库集群位于同一 VPC 中，并且必须在 VPC 模式（不是互联网模式）下配置 OpenSearch 集群。

我们建议您使用新创建的 Neptune 实例与服务配合 OpenSearch 使用。如果您使用已有数据的现有实例，则应在进行查询之前执行 OpenSearch 服务数据同步，否则可能会出现数据不一致的情况。此 GitHub 项目提供了如何执行同步的示例：将 Nep [tune 导出到 OpenSearch](https://github.com/awslabs/amazon-neptune-tools/tree/master/export-neptune-to-elasticsearch) (https://github.com/awslabs/amazon-neptune-tools/tree/master/export-neptune-to-elasticsearch)。

**重要**  
与亚马逊 OpenSearch 服务集成时，Neptune 需要 Elasticsearch 版本 7.1 或更高版本，并且可以使用 2.3、 OpenSearch 2.5 和未来兼容的 Opensearch 版本。

**注意**  
从[引擎版本 1.3.0.0](engine-releases-1.3.0.0.md) 开始，亚马逊 Neptune 支持使用[ OpenSearch 亚马逊无服务器服务](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless.html)在 Gremlin 和 SPARQL 查询中进行全文搜索。

**Topics**
+ [使用 AWS CloudFormation 模板开始 Neptune-to-OpenSearch复制](full-text-search-cfn-create.md)
+ [在现有 Neptune 数据库上启用全文搜索](full-text-search-cfn-enabling.md)
+ [更新流轮询器](full-text-search-cfn-update-poller.md)
+ [禁用和重新启用流轮询器进程](full-text-search-using-pausing-poller.md)

# 使用 AWS CloudFormation 模板开始 Neptune-to-OpenSearch复制
<a name="full-text-search-cfn-create"></a>

## 启动特定于您所在地区的 CloudFormation 堆栈
<a name="full-text-search-cfn-by-region"></a>

以下每个 CloudFormation 模板都会在特定 AWS 区域创建一个 Streams-consumer 应用程序实例。要使用 CloudFormation 控制台启动相应的堆栈，请根据要使用的 AWS 区域，选择下表中的**启动堆栈**按钮之一。


| Region | 视图 | 在 Designer 中查看 | 启动 | 
| --- | --- | --- | --- | 
| 美国东部（弗吉尼亚州北部） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=us-east-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 美国东部（俄亥俄州） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=us-east-2&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 美国西部（北加利福尼亚） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=us-west-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=us-west-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=us-west-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 美国西部（俄勒冈州） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=us-west-2&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 加拿大（中部） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=us-west-2&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=ca-central-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=ca-central-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 南美洲（圣保罗） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=sa-east-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=sa-east-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=sa-east-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 欧洲地区（斯德哥尔摩） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=eu-north-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=eu-north-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=eu-north-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 欧洲地区（爱尔兰） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=eu-west-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 欧洲地区（伦敦） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=eu-west-2&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=eu-west-2#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=eu-west-2#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 欧洲地区（巴黎） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=eu-west-3&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=eu-west-3#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=eu-west-3#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 欧洲（西班牙） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=eu-south-2&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=eu-south-2#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=eu-south-2#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 欧洲地区（法兰克福） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=eu-central-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 中东（巴林） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=me-south-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=me-south-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=me-south-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 中东（阿联酋）： | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=me-central-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=me-central-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=me-central-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 以色列（特拉维夫） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=il-central-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=il-central-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=il-central-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 非洲（开普敦） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=af-south-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=af-south-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=af-south-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 亚太地区（香港） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=ap-east-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=ap-east-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=ap-east-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 亚太地区（东京） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=ap-northeast-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 亚太地区（首尔） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=ap-northeast-2&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-2#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-2#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 亚太地区（新加坡） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=ap-southeast-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 亚太地区（雅加达） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=ap-southeast-3&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-3#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-3#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 亚太地区（孟买） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.aws.amazon.com/cloudformation/designer/home?region=ap-south-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.aws.amazon.com/cloudformation/home?region=ap-south-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.aws.amazon.com/cloudformation/home?region=ap-south-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 中国（北京） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.amazonaws.cn/cloudformation/designer/home?region=cn-north-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.amazonaws.cn/cloudformation/home?region=cn-north-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.amazonaws.cn/cloudformation/home?region=cn-north-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| 中国（宁夏） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.amazonaws.cn/cloudformation/designer/home?region=cn-northwest-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.amazonaws.cn/cloudformation/home?region=cn-northwest-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.amazonaws.cn/cloudformation/home?region=cn-northwest-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| AWS GovCloud （美国西部） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.amazonaws-us-gov.com/cloudformation/designer/home?region=us-gov-west-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.amazonaws-us-gov.com/cloudformation/home?region=us-gov-west-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.amazonaws-us-gov.com/cloudformation/home?region=us-gov-west-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 
| AWS GovCloud （美国东部） | [视图](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在 Designer 中查看](https://console.amazonaws-us-gov.com/cloudformation/designer/home?region=us-gov-east-1&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [https://console.amazonaws-us-gov.com/cloudformation/home?region=us-gov-east-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json](https://console.amazonaws-us-gov.com/cloudformation/home?region=us-gov-east-1#/stacks/new?stackName=NeptuneQuickStart&templateURL=https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json)  | 

在 **Create stack (创建堆栈)** 主页上，选择 **Next (下一步)**。

## 添加有关您正在创建的新 OpenSearch 堆栈的详细信息
<a name="full-text-search-cfn-stack-details"></a>

**指定堆栈详细信息**页面提供了属性和参数，可用于控制全文搜索的设置：

**堆栈名称**-您正在创建的新 CloudFormation 堆栈的名称。通常可以使用默认值 `NeptuneStreamPoller`。

在 **Parameters (参数)** 下，提供以下内容：

**流使用者运行的 VPC 的网络配置**
+ **`VPC`** – 提供将运行轮询 Lambda 函数的 VPC 的名称。
+ **`List of Subnet IDs`** – 建立网络接口的子网。添加与您的 Neptune 集群对应的子网。
+ **`List of Security Group Ids`**— 提供授予 IDs 对源 Neptune 数据库集群的入站写入访问权限的安全组。
+ **`List of Route Table Ids`** – 如果您还没有 Amazon DynamoDB 端点，则需要在 Neptune VPC 中创建一个。您必须提供与子网 IDs 关联的以逗号分隔的路由表列表。
+ **`Require to create Dynamo DB VPC Endpoint`** – 默认为 `true` 的布尔值。如果您已在 VPC 中创建 DynamoDB 端点，则只需将其更改为 `false`。
+ **`Require to create Monitoring VPC Endpoint`** – 默认为 `true` 的布尔值。如果您已在 VPC 中创建镜像终端节点，则只需将其更改为 `false`。

**流轮询器**
+ **`Application Name`** – 您通常可以将此设置保留为默认值 (`NeptuneStream`)。如果您使用不同的名称，则该名称必须是唯一的。
+ **`Memory size for Lambda Poller`** – 用于设置 lambda 轮询器函数可用的内存大小。默认值为 2,048 MB。
+ **`Lambda Runtime`** – 从 Neptune 流中检索项目的 Lambda 函数使用的语言。您可以将其设置为 `python3.9` 或 `java8`。
+ **`S3 Bucket having Lambda code artifacts`** – 除非您使用从其它 S3 桶加载的自定义 Lambda 轮询函数，否则将此设置保留为空。
+ **`S3 Key corresponding to Lambda Code artifacts`** – 除非您使用自定义 Lambda 轮询函数，否则将此设置保留为空。
+ **`StartingCheckpoint`** – 流轮询器的起始检查点。默认值为 `0:0`，表示从 Neptune 流的开头开始。
+ **`StreamPollerInitialState`** – 轮询器的初始状态。默认值为 `ENABLED`，这意味着流复制将在整个堆栈创建完成后立即开始。
+ **`Logging level for Lambda`** – 通常，将此设置保留为默认值 `INFO`。
+ **`Managed Policies for Lambda Execution`** – 通常，除非您使用自定义 Lambda 轮询函数，否则将此设置保留为空。
+ **`Stream Records Handler`** – 通常，除非您为 Neptune 流中的记录使用自定义处理程序，否则将此设置保留为空。
+ **`Maximum records Fetched from Stream`** – 您可以使用此参数来优化性能。默认值 (`100`) 是一个很好的开始。允许的最大值为 10,000。数字越大，从流读取记录所需的网络调用就越少，但处理记录所需的内存越多。
+ **`Max wait time between two Polls (in Seconds)`** – 确定调用 Lambda 轮询器来轮询 Neptune 流的频率。将此值设置为 0 以进行连续轮询。最大值为 3600 秒（1 小时）。默认值（60 秒）是一个很好的开始，具体取决于图形数据更改的速度。
+ **`Maximum Continuous polling period (in Seconds)`** – 用于设置 Lambda 轮询函数的超时。它应该是 5 秒到 900 秒之间。默认值（600 秒）是一个很好的开始。
+ **`Step Function Fallback Period`**— 等待轮询器的 step-function-fallback-period单位数，之后通过 Amazon CloudWatch Events 调用步骤函数以从故障中恢复。默认值（5 分钟）是一个很好的开始。
+ **`Step Function Fallback Period Unit`** –用于测量上述 `Step Function Fallback Period` 的时间单位（分钟、小时、天）。默认值（分钟）通常就足够了。
+ **`Enable/disable creation of Elastic Search Mappings by Lambda`**— 标记为由直播轮询器 enable/disable 自动管理弹性搜索映射。弹性搜索映射对于 Neptune 和弹性搜索数据类型之间的转换至关重要。只有希望直接手动控制其 Elastic Search 索引中所有映射的高级用户才应禁用此功能。默认值为 `true`。
+ **`Data replication scope`**— 确定是同时复制节点和边缘，还是只复制节点 OpenSearch （这仅适用于 Gremlin 引擎数据）。默认值（All (全部)）通常是一个很好的开始。
+ **`Ignore OpenSearch missing document error`**— 用于确定是否 OpenSearch 可以忽略中的缺失文档错误的标志。缺少文档错误很少发生，但如果不忽略，则需要手动干预。默认值（`True`）通常是一个很好的开始。
+ **`Enable Non-String Indexing`** – 用于启用或禁用对没有字符串内容的字段编制索引的标志。如果将此标志设置为`true`，则对非字符串字段进行索引 OpenSearch，或者如果`false`仅对字符串字段进行索引。默认值为 `true`。
+ **`Properties to exclude from being inserted into OpenSearch`**— 要从索引中排除的属性或谓词键的逗号分隔列表。 OpenSearch 如果将此 CFN 参数值留空，则会对所有属性键编制索引。
+ **`Datatypes to exclude from being inserted into OpenSearch`**— 要从索引中排除的属性或谓词数据类型的逗号分隔列表。 OpenSearch 如果将此 CFN 参数值留空，则会对所有可以安全转换为 OpenSearch 数据类型的属性值进行索引。

**Neptune 流**
+ **`Endpoint of source Neptune Stream`** –（*必需*）采用以下两种形式之一：
  + **`https://your DB cluster:port/propertygraph/stream`**（或其别名 `https://your DB cluster:port/pg/stream`）。
  + `https://your DB cluster:port/sparql/stream`
+ **`Neptune Query Engine`** – 选择 Gremlin 或 SPARQL。
+ **`Is IAM Auth Enabled?`** – 如果您的 Neptune 数据库集群使用 IAM 身份验证，请将此参数设置为 `true`。
+ **`Neptune Cluster Resource Id`** – 如果您的 Neptune 数据库集群使用 IAM 身份验证，请将此参数设置为集群资源 ID。资源 ID 与集群 ID 不同。相反，它采取的形式是：`cluster-` 后跟 28 个字母数字字符。可以在 Neptune 控制台的**集群详细信息**下找到它。

**目标 OpenSearch 集群**
+ **`Endpoint for OpenSearch service`**—（必需）在您的 VPC 中提供 OpenSearch 服务的终端节点。
+ **`Number of Shards for OpenSearch Index`** – 默认值 (5) 通常是一个很好的开始。
+ **`Number of Replicas for OpenSearch Index`** – 默认值 (1) 通常是一个很好的开始。
+ **`Geo Location Fields for Mapping`** – 如果您使用的是地理位置字段，请在此处列出属性键。

**警报**
+ **`Require to create Cloud watch Alarm`**— `true` 如果要为新堆栈创建 CloudWatch 警报，请将其设置为。
+ **`SNS Topic ARN for Cloudwatch Alarm Notifications`**— 应在 CloudWatch 其中发送警报通知的 SNS 主题 ARN（仅在启用警报时才需要）。
+ **`Email for Alarm Notifications`** – 应向其发送警报通知的电子邮件地址（仅在启用警报时才需要）。

对于警报通知的目标，您可以添加仅限 SNS、仅限电子邮件或同时使用 SNS 和电子邮件。

## 运行 CloudFormation 模板
<a name="full-text-search-cfn-complete"></a>

现在，您可以完成预调配 Neptune 流使用者应用程序实例的过程，如下所示：

1. 在 CloudFormation**指定堆栈详细信息**页面上，选择**下一步**。

1. 在**选项**页面上，选择**下一步**。

1. 在**审核**页面上，选中第一个复选框以确认 CloudFormation 将创建 IAM 资源。选中第二个复选框以确认新堆栈的 `CAPABILITY_AUTO_EXPAND`。
**注意**  
`CAPABILITY_AUTO_EXPAND` 明确确认在创建堆栈时将扩展宏，而无需事先审核。用户通常通过处理的模板创建更改集，以便在实际创建堆栈之前对宏所做的更改进行审核。有关更多信息，请参阅《 CloudFormation [CreateStack](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html)API *参考》中的AWS CloudFormation API* 操作。

   然后选择**创建**。

# 在现有 Neptune 数据库上启用全文搜索
<a name="full-text-search-cfn-enabling"></a>

 这些是在现有 Amazon Neptune 数据库上启用全文搜索的既定方法。根据您是否可以暂停写入工作负载，步骤可能会略有不同。本指南概述了以下两种情况下的推荐步骤：可以暂停写入时和无法暂停写入时。它包括启用 Neptune 流、创建数据库克隆、将数据同步到 OpenSearch 域以及设置持续更新。该指南利用 AWS 服务和开源工具来简化流程并最大限度地减少停机时间。

## 如果您可以暂停写入工作负载
<a name="full-text-search-cfn-enabling-with-pause"></a>

在现有 Neptune 数据库上启用全文搜索的最佳方法通常如下所示，前提是您可以暂停写入工作负载。它需要创建克隆，使用集群参数启用流，然后重新启动所有实例。创建克隆的操作相对较快，因此所需的停机时间是有限的。

下面列出了所需的步骤：

1. 停止数据库上的所有写入工作负载。

1. 在数据库上启用流（请参阅[启用 Neptune 流](streams-using-enabling.md)）。

1. 创建数据库的克隆（请参阅 [Neptune 中的数据库克隆](manage-console-cloning.md)）。

1. 恢复写入工作负载。

1. 使用 github 上的[export-neptune-to-elasticsearch](https://github.com/awslabs/amazon-neptune-tools/tree/master/export-neptune-to-elasticsearch)工具执行从克隆的数据库到 OpenSearch域的一次性同步。

1. 使用[您所在区域的CloudFormation 模板](https://docs.aws.amazon.com/neptune/latest/userguide/full-text-search-cfn-create.html#full-text-search-cfn-by-region)从原始数据库开始同步，并进行持续更新（无需更改模板中的配置）。

1. 删除克隆的数据库和为该`export-neptune-to-elasticsearch`工具创建的 CloudFormation 堆栈。

**注意**  
如果[export-neptune-to-elasticsearch](https://github.com/awslabs/amazon-neptune-tools/tree/master/export-neptune-to-elasticsearch)与 Opensearch Serverless 一起使用，则必须将 [export-neptune-to-elasticsearch](https://github.com/awslabs/amazon-neptune-tools/tree/master/export-neptune-to-elasticsearch)Cloudformation 堆栈`LambdaExecutionRole`创建的堆栈添加到 [Opensearch 数据访问策略](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-data-access.html)中才能成功复制数据。

## 如果您无法暂停写入工作负载
<a name="full-text-search-cfn-enabling-without-pause"></a>

如果您承担不起在数据库上暂停写入工作负载的代价，那么以下方法所需的停机时间甚至比上述推荐的方法还要少，但需要谨慎行事：

1. 在数据库上启用流（请参阅[启用 Neptune 流](streams-using-enabling.md)）。

1. 创建数据库的克隆（请参阅 [Neptune 中的数据库克隆](manage-console-cloning.md)）。

1. 通过对 Streams API 端点执行此类命令，获取克隆数据库上流的最新 `eventID`（有关更多信息，请参阅[调用 Neptune Streams REST API](streams-using-api-call.md)）：

   ```
   curl "https://(your neptune endpoint):(port)/(propertygraph or sparql)/stream?iteratorType=LATEST"
   ```

   记下响应的 `lastEventId` 对象中 `commitNum` 和 `opNum` 字段的值。

1. 使用 github 上的[export-neptune-to-elasticsearch](https://github.com/awslabs/amazon-neptune-tools/tree/master/export-neptune-to-elasticsearch)工具执行从克隆的数据库到 OpenSearch域的一次性同步。

1. 使用[您所在区域的CloudFormation 模板](https://docs.aws.amazon.com/neptune/latest/userguide/full-text-search-cfn-create.html#full-text-search-cfn-by-region)从原始数据库开始同步，并进行持续更新。

   创建堆栈时进行以下更改：在堆栈详细信息页面的**参数**部分中，**opnum**使用上面记录的`commitNum`和值，将该`StartingCheckpoint`字段的`opNum`值设置为**commitNum**:。

1. 删除克隆的数据库和为该`export-neptune-to-elasticsearch`工具创建的 CloudFormation 堆栈。

# 更新流轮询器
<a name="full-text-search-cfn-update-poller"></a>

 以下信息概述了使用管理控制台使用 AWS 最新 Lambda 项目更新流轮询器所需的步骤。

## 使用最新的 Lambda 构件更新流轮询器
<a name="full-text-search-cfn-update-poller-lambda"></a>

您可以使用最新的 Lambda 代码构件更新流轮询器，如下所示：

1. 在中 AWS 管理控制台，导航到主父 CloudFormation 堆栈 CloudFormation 并选择该堆栈。

1. 为堆栈选择**更新**选项。

1. 选择**替换当前模板**。

1. 对于模板源，选择 **Amazon S3 URL** 并输入以下 S3 URL：

   ```
   https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json
   ```

1. 在不更改任何 CloudFormation 参数的情况下选择 “**下一步**”。

1. 选择 **Update Stack**。

现在，堆栈将使用最新的构件更新 Lambda 构件。

## 扩展流轮询器以支持自定义字段
<a name="full-text-search-using-custom-fields"></a>

可以轻松扩展当前的流轮询器以编写用于处理自定义字段的自定义代码，正如这篇博客文章中详细介绍的那样：[使用 Neptune Streams 捕获图形更改](https://aws.amazon.com/blogs/database/capture-graph-changes-using-neptune-streams/)。

**注意**  
在中添加自定义字段时 OpenSearch，请确保将新字段添加为谓词的内部对象（请参阅[Neptune 全文搜索数据模型](full-text-search-model.md)）。

# 禁用和重新启用流轮询器进程
<a name="full-text-search-using-pausing-poller"></a>

**警告**  
禁用流轮询器进程时务必小心！如果进程的暂停时间超过流到期时段，则可能会发生数据丢失。默认时段为 7 天，但从引擎版本 [1.2.0.0](engine-releases-1.2.0.0.md) 开始，您可以将自定义流过期时段设置为最长 90 天。

# 禁用（暂停）流轮询器进程
<a name="full-text-search-pause-poller"></a>

1. 登录 AWS 管理控制台 并打开 Amazon EventBridge 控制台，网址为[https://console.aws.amazon.com/events/](https://console.aws.amazon.com/events/)。

1. 在导航窗格中选择**规则**。

1. 选择一个规则，其名称包含您在用于设置直播轮询器的 CloudFormation 模板中作为**应用程序名称**提供的名称。

1. 选择**禁用**。

1. 打开 Step Functions 控制台，网址为[https://console.aws.amazon.com/states/](https://console.aws.amazon.com/states/)。

1. 选择与流轮询器进程对应的正在运行的步进函数。同样，该步骤函数的名称包含您在用于设置流轮询器的 CloudFormation 模板中作为**应用程序名称**提供的名称。您可以按函数执行状态进行筛选，以仅查看**正在运行**的函数。

1. 选择**停止**。

# 重新启用流轮询器进程
<a name="full-text-search-re-enable-poller"></a>

1. 登录 AWS 管理控制台 并打开 Amazon EventBridge 控制台，网址为[https://console.aws.amazon.com/events/](https://console.aws.amazon.com/events/)。

1. 在导航窗格中选择**规则**。

1. 选择一个规则，其名称包含您在用于设置直播轮询器的 CloudFormation 模板中作为**应用程序名称**提供的名称。

1. 请选择**启用**。基于指定计划间隔的事件规则现在将触发步进函数的新执行。