Elastic Cloud
编辑Elastic Cloud
编辑Search::Elasticsearch 可用于连接到 Elastic Cloud。
要将 Perl 客户端连接到 Elastic Cloud,您需要获取以下数据
- Elasticsearch 服务器地址(即公共 URL);
- Elastic Cloud API 密钥;
您可以在 Elastic Cloud 仪表板中检索这些数据。您需要打开管理部署页面并复制 Elasticsearch 端点(参见下面的屏幕截图)。

此端点是测试实例的服务器地址(例如 https://my-test.es.us-central1.gcp.cloud.es.io)。
在此步骤之后,您需要在管理页面下的安全部分生成一个API 密钥。

当您点击创建 API 密钥按钮时,您可以选择一个名称并设置其他选项(例如,限制权限,过期时间等)。

在此步骤之后,您将在 API 密钥页面中获得API 密钥。

重要:您需要将 `API 密钥` 复制并存储在安全的地方,因为您将无法在 Elastic Cloud 中再次查看它。
最后,您可以使用 Elasticsearch 端点和 API 密钥连接 Perl 客户端,如下所示
my $e = Search::Elasticsearch->new( nodes => [ 'https://my-test.es.us-central1.gcp.cloud.es.io' ], elastic_cloud_api_key => 'insert here the API Key' );