Briefly, this error occurs when you try to create an Elasticsearch policy that already exists. Elasticsearch doesn’t allow duplicate policies, hence the error. To resolve this, you can either delete the existing policy before creating a new one with the same name, or you can update the existing policy if you want to make changes. Alternatively, you can create a new policy with a different name if the existing policy is still needed.
This guide will help you check for common problems that cause the log ” policy [{}] already exists ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.
Log Context
Log “policy [{}] already exists” class name is EnrichStore.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :
} final Mappolicies = getPolicies(current); EnrichPolicy existing = policies.putIfAbsent(name; finalPolicy); if (existing != null) { throw new ResourceAlreadyExistsException("policy [{}] already exists"; name); } return policies; }); }