DBAtlas · Database operations atlas

max_bytes_length_exceeded_exception: Document contains at least one immense term that is too long

Elasticsearch

What does it mean?

In a document being indexed, a term (especially a keyword/non-analyzed field value) exceeded the maximum allowed byte length (32766 bytes). Lucene cannot index a term that long.

Why does it happen?

A very long text value written to a keyword field (as a whole); e.g. an entire document body, base64 data or a long URL/identifier placed in a keyword field. Because keyword fields are not analyzed, the value is indexed as a single term and exceeds the limit.

How to fix it

Use a text (analyzed) field for long text; keyword is only for short values that need exact matching. To cap the value, use ignore_above in the mapping (values longer than this are not indexed but are still stored). If not needed, set very long fields to index:false. Re-evaluate the field design (text vs keyword) based on the data type.

Open in DBAtlas →

More from this engine