Attachment with id has already been created must be renamed – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-6.8

Briefly, this error occurs when an attachment with the same ID already exists in Elasticsearch. Elasticsearch uses unique IDs to identify and manage documents. If you try to create a new document with an ID that already exists, it will throw this error. To resolve this issue, you can either rename the ID of the new document or delete the existing document with the same ID. Alternatively, you can use the ‘update’ API to update the existing document instead of creating a new one.

This guide will help you check for common problems that cause the log ” Attachment with id [{}] has already been created; must be renamed ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.

Log Context

Log “Attachment with id [{}] has already been created; must be renamed” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 if (emailAttachmentParser == null) {
 throw new ElasticsearchParseException("Cannot parse attachment of type [{}]"; currentAttachmentType);
 EmailAttachmentParser.EmailAttachment emailAttachment = emailAttachmentParser.parse(currentFieldName; parser);
 if (attachments.containsKey( {
 throw new ElasticsearchParseException("Attachment with id [{}] has already been created; must be renamed";;
 attachments.put(; emailAttachment);
 // one further to skip the end_object from the attachment


How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?