

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# Amazon Neptune 至 OpenSearch 的複寫
<a name="full-text-search-cfn-setup"></a>

Amazon Neptune 支援使用 Amazon OpenSearch Service (OpenSearch Service) 在 Gremlin 和 SPARQL 查詢中進行全文檢索搜尋。您可以使用 AWS CloudFormation 堆疊將 OpenSearch Service 網域連結至 Neptune。 CloudFormation 範本會建立提供 Neptune-to-OpenSearch 複寫的串流消費者應用程式執行個體。

在開始之前，您需要一個已啟用串流的現有 Neptune 資料庫叢集做為來源，以及一個 OpenSearch Service 網域做為複寫目標。

如果您 Neptune 資料庫叢集所在的 VPC 中，已有可供 Lambda 存取的現有目標 OpenSearch Service 網域，則範本可使用該網域。否則，您需要建立一個新的網域。

**注意**  
您建立的 OpenSearch 叢集和 Lambda 函數必須位於與 Neptune 資料庫叢集相同的 VPC 中，且 OpenSearch 叢集必須是在 VPC 模式 (而非網際網路模式) 中設定。

建議您使用新建立的 Neptune 執行個體與 OpenSearch Service 搭配使用。如果您使用其中已有資料的現有執行個體，則應該在進行查詢之前先執行 OpenSearch Service 資料同步，否則可能會發生資料不一致。這個 GitHub 專案提供如何執行同步的範例：[將 Neptune 匯出至 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)。

**重要**  
與 Amazon OpenSearch Service 整合時，Neptune 需要 Elasticsearch 7.1 版或更高版本，並會使用 OpenSearch 2.3、2.5，以及未來相容的 Opensearch 版本。

**注意**  
從[引擎版本 1.3.0.0](engine-releases-1.3.0.0.md) 開始，Amazon Neptune 支援使用 [Amazon OpenSearch Service Serverless](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 區域中建立串流消費者應用程式執行個體。若要使用 CloudFormation 主控台啟動對應的堆疊，請根據您要使用的 AWS 區域，選擇下表中的其中一個**啟動堆疊**按鈕。


| 區域 | 檢視 | 在設計工具中檢視 | 啟動 | 
| --- | --- | --- | --- | 
| 美國東部 (維吉尼亞北部) | [檢視](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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)  | 
| Europe (Paris) | [檢視](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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)  | 
| Middle East (Bahrain) | [檢視](https://aws-neptune-customer-samples.s3.amazonaws.com/neptune-stream/neptune_to_elastic_search.json) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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) | [在設計工具中檢視](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`** - 提供安全群組的 ID，這些群組會授予來源 Neptune 資料庫叢集的寫入傳入存取權。
+ **`List of Route Table Ids`** - 這是在 Neptune VPC 中建立 Amazon DynamoDB 端點的必要項目，如果您還沒有此項目，請建立一個。您必須提供與子網路相關聯的路由表 ID 逗號分隔清單。
+ **`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 可連續輪詢。最高值為 3,600 秒 (1 小時)。預設值 (60 秒) 是很好的開始，視圖表資料變更的速度而定。
+ **`Maximum Continuous polling period (in Seconds)`** - 用來設定 Lambda 輪詢函數的逾時。應介於 5 秒到 900 秒之間。預設值 (600 秒) 是很好的開始。
+ **`Step Function Fallback Period`** - 等待輪詢器的 step-function-fallback-period 單位數，在此之後透過 Amazon CloudWatch Events 呼叫 step function 以從失敗中復原。預設值值 (5 分鐘) 是很好的開始。
+ **`Step Function Fallback Period Unit`** - 用來測量前述 `Step Function Fallback Period` 的時間單位 (分鐘、小時、天)。通常預設值 (分鐘) 即足夠。
+ **`Enable/disable creation of Elastic Search Mappings by Lambda`** –  由串流輪詢器啟用/停用彈性搜尋映射自動管理的旗標。彈性搜尋映射對於 Neptune 和彈性搜尋資料類型之間的轉換至關重要。只有想要直接手動控制彈性搜尋索引中所有映射的進階使用者，才應該停用此功能。預設值為 `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 Service 的端點。
+ **`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`** - 如果想要為新堆疊建立 CloudWatch 警示，請將此設為 `true`。
+ **`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` 明確確認在建立堆疊時，無需事先檢閱，即可擴充巨集。使用者通常會在處理過的範本中建立變更集，以便在實際建立堆疊之前，檢閱巨集所做的變更。如需詳細資訊，請參閱《 API 參考》中的 CloudFormation [CreateStack](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html) API 操作。 *AWS CloudFormation *

   然後選擇 **Create (建立)**。

# 在現有的 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 Data Access Policy](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. 針對串流 API 端點執行此類命令，以取得所複製資料庫上串流的最新 `eventID` (如需詳細資訊，請參閱[呼叫 Neptune 串流 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)，以持續更新的方式從原始資料庫開始同步。

   在建立堆疊時進行下列變更：在堆疊詳細資訊頁面的**參數**區段中，使用您在上面記錄的 `commitNum` 和 `opNum` 值，將 `StartingCheckpoint` 欄位的值設為 **commitNum**:**opnum**。

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 串流擷取圖形變更](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 管理主控台 ，並在 https：//[https://console.aws.amazon.com/events/](https://console.aws.amazon.com/events/) 開啟 Amazon EventBridge 主控台。

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 管理主控台 ，並在 https：//[https://console.aws.amazon.com/events/](https://console.aws.amazon.com/events/) 開啟 Amazon EventBridge 主控台。

1. 在導覽窗格中，選取**規則**。

1. 選取規則，其名稱包含您在用來設定串流輪詢器的 CloudFormation 範本中作為**應用程式名稱**提供的名稱。

1. 選擇**啟用**。以所指定排程間隔為基礎的事件規則現在會觸發步驟函數的新執行。