--- title: "当用户尝试调整索引大小时不允许的操作 – 如何解决此Elasticsearch异常" date: 2026-03-23 lastmod: 2026-03-23 description: "当用户尝试调整Elasticsearch索引大小时,由于缺少必要权限而导致的异常错误及解决方案" tags: ["索引调整大小", "权限管理", "安全异常", "Elasticsearch安全"] summary: " 版本: 6.8-7.15 简而言之,当用户尝试调整Elasticsearch索引大小但没有必要的权限时,就会发生此错误。Elasticsearch具有一项安全功能,将某些操作限制为具有特定角色的用户。要解决此问题,您可以授予用户必要的权限,或者使用已经具有所需权限的用户执行调整大小操作。或者,您可以禁用安全功能,但不建议这样做,因为这可能会使您的Elasticsearch集群暴露于潜在威胁之下。 日志上下文 # 日志"Resize requests are not allowed for users when"的类名是 ResizeRequestInterceptor.java。 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入了解上下文的人使用: indicesAccessControl.getIndexPermissions(request.getSourceIndex()); if (indexAccessControl != null) { final boolean fls = indexAccessControl.getFieldPermissions().hasFieldLevelSecurity(); final boolean dls = indexAccessControl.getDocumentPermissions().hasDocumentLevelPermissions(); if ((fls || dls) && licenseChecker.get()) { listener.onFailure(new ElasticsearchSecurityException("Resize requests are not allowed for users when " + "field or document level security is enabled on the source index"; RestStatus.BAD_REQUEST)); return; } } " --- > **版本:** 6.8-7.15 简而言之,当用户尝试调整Elasticsearch索引大小但没有必要的权限时,就会发生此错误。Elasticsearch具有一项安全功能,将某些操作限制为具有特定角色的用户。要解决此问题,您可以授予用户必要的权限,或者使用已经具有所需权限的用户执行调整大小操作。或者,您可以禁用安全功能,但不建议这样做,因为这可能会使您的Elasticsearch集群暴露于潜在威胁之下。 日志上下文 ----------- 日志"Resize requests are not allowed for users when"的类名是[ResizeRequestInterceptor.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入了解上下文的人使用: ```java indicesAccessControl.getIndexPermissions(request.getSourceIndex()); if (indexAccessControl != null) { final boolean fls = indexAccessControl.getFieldPermissions().hasFieldLevelSecurity(); final boolean dls = indexAccessControl.getDocumentPermissions().hasDocumentLevelPermissions(); if ((fls || dls) && licenseChecker.get()) { listener.onFailure(new ElasticsearchSecurityException("Resize requests are not allowed for users when " + "field or document level security is enabled on the source index"; RestStatus.BAD_REQUEST)); return; } } ```