--- title: "同时设置了端点后缀和主端点 - 如何解决此 Elasticsearch 异常" date: 2026-01-30 lastmod: 2026-01-30 description: "当在Elasticsearch中同时配置了端点后缀和主端点时会出现此错误。这是因为Elasticsearch只允许设置其中一个。解决方法是从配置中移除端点后缀或主端点之一。" tags: ["Elasticsearch异常", "Azure存储", "配置错误", "端点配置", "SettingsException"] summary: " 版本: 8.8-8.9 简而言之,当在 Elasticsearch 中同时配置了端点后缀(endpoint suffix)和主端点(primary endpoint)时,会出现此错误。这是一个配置问题,因为 Elasticsearch 只允许设置其中一个。要解决此问题,您可以从配置中删除端点后缀或主端点。确保保留对您的特定用例所必需的那个。此外,确保剩余的端点配置正确,以避免进一步的问题。 日志上下文 # 日志 “Both an endpoint suffix as well as a primary endpoint were set” 的类名是 AzureStorageSettings.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解上下文的人参考: final boolean hasEndpointSuffix = Strings.hasText(endpointSuffix); final boolean hasEndpoint = Strings.hasText(endpoint); final boolean hasSecondaryEndpoint = Strings.hasText(secondaryEndpoint); 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"); } " --- > **版本:** 8.8-8.9 简而言之,当在 Elasticsearch 中同时配置了端点后缀(endpoint suffix)和主端点(primary endpoint)时,会出现此错误。这是一个配置问题,因为 Elasticsearch 只允许设置其中一个。要解决此问题,您可以从配置中删除端点后缀或主端点。确保保留对您的特定用例所必需的那个。此外,确保剩余的端点配置正确,以避免进一步的问题。 ## 日志上下文 日志 "Both an endpoint suffix as well as a primary endpoint were set" 的类名是 [AzureStorageSettings.java](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/)。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解上下文的人参考: ```java final boolean hasEndpointSuffix = Strings.hasText(endpointSuffix); final boolean hasEndpoint = Strings.hasText(endpoint); final boolean hasSecondaryEndpoint = Strings.hasText(secondaryEndpoint); 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"); } ```