--- title: "使用特定许可证时必须显式启用安全性 – 如何解决此Elasticsearch异常" date: 2026-01-22 lastmod: 2026-01-22 description: "当Elasticsearch配置为使用需要安全功能但未显式启用安全时会出现此错误。可通过在elasticsearch.yml中设置xpack.security.enabled为true来解决问题。" tags: ["安全", "许可证", "配置", "异常处理"] summary: "版本: 6.8-7.15 简而言之,当Elasticsearch被配置为使用需要安全性功能,但安全性未显式启用时,会出现此错误。这可能是由于elasticsearch.yml文件中缺少或配置不正确导致的。要解决此问题,您可以通过在elasticsearch.yml文件中将’xpack.security.enabled’设置为true来启用安全性。此外,确保许可证支持安全功能。如果不支持,您可能需要升级Elasticsearch许可证。另外,检查Elasticsearch版本是否支持安全性,因为旧版本可能没有此功能。 日志上下文 # 日志"Security must be explicitly enabled when using a [“类名称是 SecurityActionFilter.java。 我们从Elasticsearch源代码中提取以下内容,供那些寻求深入上下文的人使用: } catch (Exception e) { listener.onFailure(e); } } else if (SECURITY_ACTION_MATCHER.test(action)) { if (licenseState.isSecurityEnabled() == false) { listener.onFailure(new ElasticsearchException("Security must be explicitly enabled when using a [" + licenseState.getOperationMode().description() + "] license. " + "Enable security by setting [xpack.security.enabled] to [true] in the elasticsearch.yml file " + "and restart the node.")); } else { listener." --- > **版本:** 6.8-7.15 简而言之,当Elasticsearch被配置为使用需要安全性功能,但安全性未显式启用时,会出现此错误。这可能是由于elasticsearch.yml文件中缺少或配置不正确导致的。要解决此问题,您可以通过在elasticsearch.yml文件中将'xpack.security.enabled'设置为true来启用安全性。此外,确保许可证支持安全功能。如果不支持,您可能需要升级Elasticsearch许可证。另外,检查Elasticsearch版本是否支持安全性,因为旧版本可能没有此功能。 日志上下文 ----------- 日志"Security must be explicitly enabled when using a ["类名称是[SecurityActionFilter.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从Elasticsearch源代码中提取以下内容,供那些寻求深入上下文的人使用: ```java } catch (Exception e) { listener.onFailure(e); } } else if (SECURITY_ACTION_MATCHER.test(action)) { if (licenseState.isSecurityEnabled() == false) { listener.onFailure(new ElasticsearchException("Security must be explicitly enabled when using a [" + licenseState.getOperationMode().description() + "] license. " + "Enable security by setting [xpack.security.enabled] to [true] in the elasticsearch.yml file " + "and restart the node.")); } else { listener.onFailure(LicenseUtils.newComplianceException(XPackField.SECURITY)); ```