【发布时间】:2018-03-23 09:29:39
【问题描述】:
我尝试从远程服务器重新索引。 远程服务器上的 Elasticsearch 实例位于 nginx 代理后面,其 url 为 api.example.com/api/elasticsearch 端口 80。
我能够访问远程弹性搜索并执行查询。例如。
curl http://api.example.com:80/api/elasticsearch/_cat/indices?v
给出预期的结果。
但是,当我尝试从远程索引重新索引本地弹性搜索索引时,如下所示
curl -X POST http://elasticsearch:9200/_reindex -d '{
"source": {
"remote": {
"host": "http://api.example.com/api/elasticsearch:80"
},
"index": "alias_name"
},
"dest": {
"index": "index_name"
}
}'
我收到一个错误:
{"error":{"root_cause":[{"type":"unknown_host_exception","reason":"api.example.com/api/elasticsearch: Name or service not known"}],"type":"unknown_host_exception","reason":"api.example.com/api/elasticsearch: Name or service not known"},"status":500}
【问题讨论】:
-
在第一个例子中,地址字符串是“api.example.com:80/api/elasticsearch”,在第二个例子中是“api.example.com/api/elasticsearch:80”。为什么你改变了地址字符串中端口的位置?
-
当我在重新索引查询中使用api.example.com:80/api/elasticsearch 作为主机时,我收到此错误:[host] 必须采用 [scheme]://[host]:[port] 的形式,但是是 [@ 987654324@
-
我遇到了同样的问题。我的解决方法是在它们之间引入另一个
nginx代理,该代理在显式端口上侦听并转发呼叫。这是必要的,但效果很好。
标签: elasticsearch