AWS OpenSearch 客户端错误:无法验证服务器是 Elasticsearch

Posted

技术标签:

【中文标题】AWS OpenSearch 客户端错误:无法验证服务器是 Elasticsearch【英文标题】:AWS OpenSearch client error: unable to verify that the server is Elasticsearch 【发布时间】:2021-11-24 20:17:20 【问题描述】:

我正在尝试编写一个 lambda 来从 OpenSearach 域获取数据。

const  Client  = require('@opensearch-project/opensearch');
const  createAWSConnection, awsGetCredentials  = require('@acuris/aws-es-connection');

const test = async () => 

    const awsCredentials = await awsGetCredentials();
    const AWSConnection = createAWSConnection(awsCredentials);
    const client = new Client(
        ...AWSConnection,
        node: 'https://<domain-name>.us-east-2.es.amazonaws.com'
    );

    // inside async func
    await client.cat.help();
;
test();

错误:

(node:32926) ProductNotSupportedSecurityError: The client is unable to verify that the server is Elasticsearch due to security privileges on the server-side. Some functionality may not be compatible if the server is running an unsupported product.

【问题讨论】:

你找到解决办法了吗? 我还没有测试任何答案,目前正在使用 rest apis... 好的。您是否尝试在 AWS 上创建用户并将该用户添加到具有 aws elasticsearch 访问策略的组?这是使用正确的凭据。 如果您使用细粒度的访问控制,您可以参考这个博客:antstack.io/blog/getting-started-with-open-search 或者对于常规访问是的,IAM 权限可以工作, 【参考方案1】:

我遇到了同样的错误,但我使用了@elasticsearch lib 而不是@opensearch-project。也许你也可以试试。 通过降级 @elasticsearch lib 版本解决了错误。

【讨论】:

你能告诉你使用的版本吗?【参考方案2】:

尝试使用 Elasticsearch 客户端版本 7.13.0。 据docs称,它是兼容OpenSearch的最新Elasticsearch客户端。

【讨论】:

以上是关于AWS OpenSearch 客户端错误:无法验证服务器是 Elasticsearch的主要内容,如果未能解决你的问题,请参考以下文章

AWS强烈反击Elastic,欲打造自己的Elasticsearch开源产品OpenSearch

ALB + Okta SSO 身份验证背后的 AWS 托管 ElasticSearch(现在称为 OpenSearch) - 不可能吗?

为在 VPC 中运行的私有 AWS OpenSearch 集群的仪表板启用 SAML 身份验证

如何为 AWS Opensearch 域启用基于密码的身份验证?

如何使用 CloudFormation 为 Amazon OpenSearch 设置兼容模式?

无法在 Amazon Cognito 用户池中验证客户端的秘密哈希