AWS OpenSearch跨域重索引时出现无效主机错误求助
AWS同一VPC下Elasticsearch远程重索引"Invalid remote host"问题解决
问题场景
两个部署在同一VPC内的Elasticsearch 7.7(AWS OpenSearch Service)域名,按照官方步骤执行跨域远程重索引时,触发illegal_argument_exception,错误信息如下:
"error" : { "root_cause" : [ { "type" : "illegal_argument_exception", "reason" : "Invalid remote host:[.......]" } ], "type" : "illegal_argument_exception", "reason" : "Invalid remote host:[.....]" }, "status" : 400 }
执行的重索引请求:
POST _reindex?pretty=true { "source":{ "remote":{ "host":"https://endpoint:443", "socket_timeout": "60m" }, "index":"uiauto-2018071611" }, "dest":{ "index":"uiauto-2018071611" } }
核心解决步骤
- 修正remote host格式:HTTPS默认端口443无需在
host参数中指定,直接保留协议+端点即可。修正后的参数应为:"remote":{ "host":"https://你的ES-VPC内部端点", "socket_timeout": "60m" } - 配置重索引白名单:在目标ES域名的高级配置中,将源ES的VPC端点添加到
reindex.remote.whitelist,格式为reindex.remote.whitelist: "源ES端点:443"。 - 检查安全组与访问策略:确保两个ES域名的安全组互相开放9200端口,源ES的访问策略允许目标ES所在的VPC CIDR或安全组进行访问。
- 使用VPC内部端点:同一VPC下必须使用ES的VPC内部端点,不要使用公网端点,否则会触发网络验证失败。
内容的提问来源于stack exchange,提问作者nik2811
相关产品推荐
相关产品推荐

