Briefly, this error occurs when Elasticsearch tries to delete expired security tokens but fails due to issues like insufficient permissions, network problems, or a full disk. To resolve this, you can check and adjust the user permissions, ensure the network connectivity is stable, or free up some disk space. Additionally, check the Elasticsearch logs for more specific error details. If the issue persists, consider restarting the Elasticsearch node.
This guide will help you check for common problems that cause the log ” failed to delete expired tokens ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin, delete.
Overview
DELETE is an Elasticsearch API which removes a document from a specific index. This API requires an index name and _id document to delete the document.
Delete a document
DELETE /my_index/_doc/1
Notes
- A delete request throws 404 error code if the document does not already exist in the index.
- If you want to delete a set of documents that matches a query, you need to use delete by query API.
Log Context
Log “failed to delete expired tokens” classname is ExpiredTokenRemover.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :
@Override public void onFailure(Exception e) { if (isShardNotAvailableException(e)) { logger.debug("failed to delete expired tokens"; e); } else { logger.error("failed to delete expired tokens"; e); } markComplete(); } private void markComplete() {