--- title: "HTTPS URI中缺少主机名uriString - 如何解决此Elasticsearch异常" date: 2026-01-09 lastmod: 2026-01-09 description: "当Elasticsearch实例的URI在HTTPS请求中缺少主机部分时发生的错误及解决方法" tags: ["URI配置", "HTTPS", "主机配置", "连接错误"] summary: "版本: 8.2-8.9 简而言之,当Elasticsearch实例的URI(统一资源标识符)在HTTPS请求中缺少主机部分时,就会发生此错误。这可能是由于Elasticsearch设置中的配置错误造成的。要解决此问题,您应该检查Elasticsearch配置文件(elasticsearch.yml),并确保URI中指定了正确的主机。同时,验证URI的格式是否正确,以’https://‘开头,后跟主机名和端口号。如果您使用的是集群,请确保所有节点都具有正确的URI。 日志上下文 # 日志 “Host is missing in HTTPS URI [” + uriString + “].” 的类名是 JwtUtil.java. 我们从Elasticsearch源代码中提取了以下内容,以便为寻求深入理解的人提供上下文: } catch (Exception e) { throw new SettingsException("Failed to parse HTTPS URI [" + uriString + "]."; e); } if (Strings.hasText(uri.getHost()) == false) { // Example URIs w/o host: "https:/"; "https://"; "https://:443" throw new SettingsException("Host is missing in HTTPS URI [" + uriString + "]."); } return uri; } else if (uriString." --- > **版本:** 8.2-8.9 简而言之,当Elasticsearch实例的URI(统一资源标识符)在HTTPS请求中缺少主机部分时,就会发生此错误。这可能是由于Elasticsearch设置中的配置错误造成的。要解决此问题,您应该检查Elasticsearch配置文件(elasticsearch.yml),并确保URI中指定了正确的主机。同时,验证URI的格式是否正确,以'https://'开头,后跟主机名和端口号。如果您使用的是集群,请确保所有节点都具有正确的URI。 日志上下文 ----------- 日志 "Host is missing in HTTPS URI [" + uriString + "]." 的类名是 [JwtUtil.java.](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从Elasticsearch源代码中提取了以下内容,以便为寻求深入理解的人提供上下文: ```java } catch (Exception e) { throw new SettingsException("Failed to parse HTTPS URI [" + uriString + "]."; e); } if (Strings.hasText(uri.getHost()) == false) { // Example URIs w/o host: "https:/"; "https://"; "https://:443" throw new SettingsException("Host is missing in HTTPS URI [" + uriString + "]."); } return uri; } else if (uriString.startsWith("http")) { throw new SettingsException("Not allowed to use HTTP URI [" + uriString + "]. Only HTTPS is supported."); } else { ```