--- title: "同时设置了端点后缀和辅助端点 - 如何解决此 Elasticsearch 异常" date: 2026-01-14 lastmod: 2026-01-14 description: "当Elasticsearch中同时设置了端点后缀和辅助端点时会抛出此异常,这是不被允许的配置,会导致请求路由冲突。本文介绍如何解决这个问题。" tags: ["Elasticsearch", "异常处理", "Azure存储", "配置错误", "端点配置"] summary: " 版本: 8.8-8.9 简而言之,当 Elasticsearch 中存在配置问题,同时设置了端点后缀和辅助端点时,会发生此错误。这是不允许的,因为它可能导致请求路由冲突。要解决此问题,您可以从配置中删除端点后缀或辅助端点。确保一次只设置其中一个。或者,您可以检查应用程序的代码,确保它不会同时设置这两个参数。 日志上下文 # 日志 “Both an endpoint suffix as well as a secondary endpoint were set” 的类名是 AzureStorageSettings.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考: if (hasEndpointSuffix && hasEndpoint) { throw new SettingsException("Both an endpoint suffix as well as a primary endpoint were set"); } if (hasEndpointSuffix && hasSecondaryEndpoint) { throw new SettingsException("Both an endpoint suffix as well as a secondary endpoint were set"); } if (hasEndpoint == false && hasSecondaryEndpoint) { throw new SettingsException("A primary endpoint is required when setting a secondary endpoint"); } " --- > **版本:** 8.8-8.9 简而言之,当 Elasticsearch 中存在配置问题,同时设置了端点后缀和辅助端点时,会发生此错误。这是不允许的,因为它可能导致请求路由冲突。要解决此问题,您可以从配置中删除端点后缀或辅助端点。确保一次只设置其中一个。或者,您可以检查应用程序的代码,确保它不会同时设置这两个参数。 ## 日志上下文 日志 "Both an endpoint suffix as well as a secondary endpoint were set" 的类名是 [AzureStorageSettings.java](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/)。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考: ```java if (hasEndpointSuffix && hasEndpoint) { throw new SettingsException("Both an endpoint suffix as well as a primary endpoint were set"); } if (hasEndpointSuffix && hasSecondaryEndpoint) { throw new SettingsException("Both an endpoint suffix as well as a secondary endpoint were set"); } if (hasEndpoint == false && hasSecondaryEndpoint) { throw new SettingsException("A primary endpoint is required when setting a secondary endpoint"); } ```