No API key owned by requesting user found for ID apiKeyId – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 8.4-8.4

Briefly, this error occurs when the Elasticsearch API key provided in the request is either incorrect or does not belong to the user making the request. This could be due to a typo in the key or a mismatch between the user and the key. To resolve this issue, you can verify the API key and ensure it belongs to the correct user. If the key is incorrect, generate a new one. If the user is incorrect, ensure the user associated with the key is making the request.

This guide will help you check for common problems that cause the log ” no API key owned by requesting user found for ID [” + apiKeyId + “] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.

Log Context

Log “no API key owned by requesting user found for ID [” + apiKeyId + “]” class name is ApiKeyService.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 findVersionedApiKeyDocsForSubject(authentication; new String[] { request.getId() }; ActionListener.wrap((versionedDocs) -> {
 final var apiKeyId = request.getId();  if (versionedDocs.isEmpty()) {
 throw new ResourceNotFoundException("no API key owned by requesting user found for ID [" + apiKeyId + "]");
 }  final VersionedApiKeyDoc versionedDoc = singleDoc(apiKeyId; versionedDocs);  validateCurrentApiKeyDocForUpdate(apiKeyId; authentication; versionedDoc.doc());

 

 [ratemypost]