版本: 7.7-8.9
简而言之,当 Elasticsearch 尝试执行需要用户认证的操作,但当前上下文中没有可用的用户信息时,就会发生此错误。这可能是由于缺少或错误的认证凭据导致的。要解决此问题,请确保在请求中提供了有效的认证凭据。如果您使用的是 Elasticsearch 客户端,请检查其配置。如果您使用的是 Elasticsearch 的安全功能,请确保用户具有执行该操作所需的权限。
日志上下文 #
日志"there is no user available in the current context"的类名是 SecurityContext.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解上下文的人参考:
* if the current request has no authentication information.
*/
public User requireUser() {
User user = getUser();
if (user == null) {
throw new ElasticsearchSecurityException("there is no user available in the current context");
}
return user;
} /** Returns the current user information; or null if the current request has no authentication info. */





