版本: 6.8-7.4
简而言之,当用户尝试在 Elasticsearch 中创建 API 密钥但由于权限不足、语法错误或 Elasticsearch 集群配置不当而失败时,会出现此错误。要解决此问题,请确保用户具有创建 API 密钥所需的权限。如果权限不是问题所在,请检查用于创建 API 密钥的命令语法。最后,验证 Elasticsearch 集群是否正确配置并正常运行。
日志上下文 #
日志 “create api key” 的类名是 ApiKeyService.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:
securityIndex.prepareIndexIfNeededThenExecute(listener::onFailure, () ->
executeAsyncWithOrigin(client, SECURITY_ORIGIN, SearchAction.INSTANCE, searchRequest,
ActionListener.wrap(
indexResponse -> {
if (indexResponse.getHits().getTotalHits().value > 0) {
listener.onFailure(traceLog("create api key", new ElasticsearchSecurityException(
"Error creating api key as api key with name [{}] already exists", request.getName())));
} else {
createApiKeyAndIndexIt(authentication, request, userRoles, listener);
}
}





