📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 6.8-8.9

简而言之,当Elasticsearch无法找到与提供的API密钥关联的任何角色描述符时,就会发生此错误。这可能是由于配置不正确或API密钥未分配任何角色导致的。要解决此问题,您可以为API密钥分配角色,或检查配置以确保其正确设置。此外,请确保API密钥有效且未过期。如果问题仍然存在,考虑重新生成新的API密钥并为其分配必要的角色。

日志上下文 #

日志"no role descriptors found for API key"的类名是 Subject.java。 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考:

assert ApiKey.Type.REST == getApiKeyType() : "only a REST API key should have its role built here";  final BytesReference roleDescriptorsBytes = (BytesReference) metadata.get(API_KEY_ROLE_DESCRIPTORS_KEY);
 final BytesReference limitedByRoleDescriptorsBytes = getLimitedByRoleDescriptorsBytes();
 if (roleDescriptorsBytes == null && limitedByRoleDescriptorsBytes == null) {
 throw new ElasticsearchSecurityException("no role descriptors found for API key");
 }  final RoleReference.ApiKeyRoleReference limitedByRoleReference = new RoleReference.ApiKeyRoleReference(
 apiKeyId,
 limitedByRoleDescriptorsBytes