java 如何修复 URI 未在 ClientProtocolException 中指定有效主机名:

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32884005/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 20:55:54  来源:igfitidea点击:

How to fix the URI does not specify a valid host name in ClientProtocolException:

javaelasticsearchjest

提问by mohan

Hi When i execute the elastic search java API using jest client i face the following error

嗨,当我使用 jest 客户端执行弹性搜索 java API 时,我面临以下错误

org.apache.http.client.ClientProtocolException: URI does not specify a valid host name:localhost:9200/index/type/_search

org.apache.http.client.ClientProtocolException: URI 未指定有效的主机名:localhost:9200/index/type/_search

i try various possibilities to fix this error,but it wont works is any one guide me to fix this?.Thanks in advance.

我尝试了各种可能性来修复这个错误,但它不起作用有人指导我解决这个问题吗?提前致谢。

回答by Val

You just need to add http://at the beginning of the URI.

您只需要http://在 URI 的开头添加。