--- title: "Azure代理端口或主机已设置但代理类型未定义 - 如何解决此Elasticsearch异常" date: 2026-02-28 lastmod: 2026-02-28 description: "当Elasticsearch配置使用Azure作为快照仓库时,即使设置了代理主机或端口,但未定义Azure连接的代理类型,就会出现此错误。解决方法是在Elasticsearch配置中指定代理类型(http或https)。" tags: ["Elasticsearch", "Azure存储", "代理配置", "快照仓库", "配置错误"] summary: "版本: 6.8-8.9 简而言之,当Elasticsearch配置使用Azure作为快照仓库时,即使设置了代理主机或端口,但未定义Azure连接的代理类型,就会出现此错误。要解决此问题,您需要在Elasticsearch配置中指定代理类型。代理类型可以是"http"或"https"。如果您不使用代理,请确保配置中未设置代理主机和端口。 日志上下文 # 日志 “Azure Proxy port or host have been set but proxy type is not defined.” 的类名是 AzureStorageSettings.java. 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考: this.timeout = timeout; this.maxRetries = maxRetries; // Register the proxy if we have any // Validate proxy settings if (proxyType.equals(Proxy.Type.DIRECT) && ((proxyPort != 0) || Strings.hasText(proxyHost))) { throw new SettingsException("Azure Proxy port or host have been set but proxy type is not defined." --- > **版本:** 6.8-8.9 简而言之,当Elasticsearch配置使用Azure作为快照仓库时,即使设置了代理主机或端口,但未定义Azure连接的代理类型,就会出现此错误。要解决此问题,您需要在Elasticsearch配置中指定代理类型。代理类型可以是"http"或"https"。如果您不使用代理,请确保配置中未设置代理主机和端口。 ## 日志上下文 ----------- 日志 "Azure Proxy port or host have been set but proxy type is not defined." 的类名是 [AzureStorageSettings.java.](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考: ```java this.timeout = timeout; this.maxRetries = maxRetries; // Register the proxy if we have any // Validate proxy settings if (proxyType.equals(Proxy.Type.DIRECT) && ((proxyPort != 0) || Strings.hasText(proxyHost))) { throw new SettingsException("Azure Proxy port or host have been set but proxy type is not defined."); } if ((proxyType.equals(Proxy.Type.DIRECT) == false) && ((proxyPort == 0) || Strings.isEmpty(proxyHost))) { throw new SettingsException("Azure Proxy type has been set but proxy host or port is not defined."); } ```