AWS ElasticSearch 从带有方案、主机和白名单的远程集群问题重新索引

Dar*_*kar 1 cloud amazon-web-services elasticsearch aws-lambda elastic-stack

背景:

  • 我们在 6.8 版上有两个 AWS ElasticSearch 集群,位于相同的 AWS 账户和区域。
  • 我们需要将集群 1(源)中的索引之一重新索引到集群 2(目标)。

我尝试将 reindex API 用于 6.8,如ES 文档中所述

POST <https://endpoint of destination Elasticsearch>/_reindex 

    {
      "source": {
        "remote": {
          "host": "https://endpoint-of-source-elasticsearch-cluster-1.es.amazonaws.com"
        },
        "index": "source-index-name"
      },
      "dest": {
        "index": "destination-index-name"
      }
    }
Run Code Online (Sandbox Code Playgroud)

问题:

我得到以下错误

{
    "error": {
        "root_cause": [
            {
                "type": "x_content_parse_exception",
                "reason": "[8:3] [reindex] failed to parse field [source]"
            }
        ],
        "type": "x_content_parse_exception",
        "reason": "[8:3] [reindex] failed to parse field [source]",
        "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "[host] must be of the form [scheme]://[host]:[port](/[pathPrefix])? but was [https://endpoint-of-source-elasticsearch-cluster-1.es.amazonaws.com]",
            "caused_by": {
                "type": "u_r_i_syntax_exception",
                "reason": "The port was not defined in the [host]: https://endpoint-of-source-elasticsearch-cluster-1.es.amazonaws.com"
            }
        }
    },
    "status": 400
}
Run Code Online (Sandbox Code Playgroud)

可能的原因:

  1. 根据文档,主机参数必须包含方案、主机、端口(例如https://otherhost:9200)。
  2. 远程主机必须使用 reindex.remote.whitelist 属性在 elasticsearch.yaml 中明确列入白名单

由于我使用的是 AWS 集群,我不确定如何遵循主机、发布或如何将集群列入白名单的方案,因为我不知道如何在 AWS 集群上进行这些更改。

请求帮助,如果有任何可用的解决方法。谢谢,

Dar*_*kar 6

不幸的是,在 AWS 托管的 Elasticsearch 中,您将无法修改像 reindex.remote.whitelist 参数这样的静态配置设置,因为配置 reindex.remote.whitelist 参数需要修改 elasticsearch.yml 文件。这是因为 AWS ES 托管服务,目前客户无法访问操作系统/文件系统。

作为替代方案,

  1. 您可以为以前的域拍摄手动快照并将其恢复到新域。与从远程重新索引相比,这种方法一次仅影响一个域,即从中获取快照的域或将快照恢复到的域。

  2. 您还可以将Logstash与 Elasticsearch输入输出插件一起使用,从本质上从原始域中的索引读取数据并将其索引到任何其他/索引域中