Meta keys can t be longer than 20 chars but got – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.6-7.15

Briefly, this error occurs when the metadata key used in Elasticsearch exceeds the maximum allowed length of 20 characters. Elasticsearch imposes this limit to ensure efficient data handling. To resolve this issue, you can shorten your metadata key to 20 characters or less. Alternatively, you can refactor your data structure to use shorter keys or abbreviations. It’s important to ensure that the shortened keys still make sense in the context of your data.

This guide will help you check for common problems that cause the log ” [meta] keys can’t be longer than 20 chars; but got [ ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: index.

Log Context

Log “[meta] keys can’t be longer than 20 chars; but got [” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 throw new MapperParsingException("[meta] can't have more than 5 entries; but got " + meta.size() + " on field [" +
 name + "]");
 for (String key : meta.keySet()) {
 if (key.codePointCount(0; key.length()) > 20) {
 throw new MapperParsingException("[meta] keys can't be longer than 20 chars; but got [" + key +
 "] for field [" + name + "]");
 for (Object value : meta.values()) {
 if (value instanceof String) {


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?