--- title: "不能同时指定region和endpoint" date: 2026-03-20 lastmod: 2026-03-20 description: "配置Elasticsearch AWS设置时同时指定region和endpoint参数导致的错误及解决方案" tags: ["Elasticsearch", "AWS", "S3", "配置错误"] summary: " 版本: 7.4-7.17 简而言之,当您配置Elasticsearch AWS设置并同时指定’region’和’endpoint’参数时,就会出现此错误。这些参数是互斥的,意味着您应该只使用其中一个。要解决此问题,如果您想使用特定的’endpoint',可以删除’region’参数;如果您想使用’region',可以删除’endpoint’参数。确保保存更改并重新启动Elasticsearch以使更改生效。 日志上下文 日志"you must not specify both region and endpoint"的类名是 CleanupS3RepositoryCommand.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人使用: if (Strings.isNullOrEmpty(region) && Strings.isNullOrEmpty(endpoint)) { throw new ElasticsearchException("region or endpoint option is required for cleaning up S3 repository"); } if (Strings.isNullOrEmpty(region) == false && Strings.isNullOrEmpty(endpoint) == false) { throw new ElasticsearchException("you must not specify both region and endpoint"); } String accessKey = accessKeyOption.value(options); if (Strings.isNullOrEmpty(accessKey)) { throw new ElasticsearchException("access_key option is required for cleaning up S3 repository"); " --- > **版本:** 7.4-7.17 简而言之,当您配置Elasticsearch AWS设置并同时指定'region'和'endpoint'参数时,就会出现此错误。这些参数是互斥的,意味着您应该只使用其中一个。要解决此问题,如果您想使用特定的'endpoint',可以删除'region'参数;如果您想使用'region',可以删除'endpoint'参数。确保保存更改并重新启动Elasticsearch以使更改生效。 日志上下文 日志"you must not specify both region and endpoint"的类名是[CleanupS3RepositoryCommand.java](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/)。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人使用: ```java if (Strings.isNullOrEmpty(region) && Strings.isNullOrEmpty(endpoint)) { throw new ElasticsearchException("region or endpoint option is required for cleaning up S3 repository"); } if (Strings.isNullOrEmpty(region) == false && Strings.isNullOrEmpty(endpoint) == false) { throw new ElasticsearchException("you must not specify both region and endpoint"); } String accessKey = accessKeyOption.value(options); if (Strings.isNullOrEmpty(accessKey)) { throw new ElasticsearchException("access_key option is required for cleaning up S3 repository"); ```