elasticsearch
data_error
ai_generated
true
IllegalArgumentException: Field [user.name] of type [keyword] in index [logs-2025] has a length of [32768] which exceeds the maximum allowed length of 32766
ID: elasticsearch/field-length-exceeds-keyword-limit
90%Fix Rate
85%Confidence
1Evidence
2024-06-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 7.10.0 | active | — | — | — |
| 8.10.0 | active | — | — | — |
| 8.13.0 | active | — | — | — |
Root Cause
A document contains a keyword field value that exceeds the 32766-byte limit, causing indexing rejection.
generic中文
文档中的关键字字段值超过了 32766 字节的限制,导致索引被拒绝。
Official Documentation
https://www.elastic.co/guide/en/elasticsearch/reference/current/keyword.html#keyword-field-type-limitsWorkarounds
-
90% success Change the field type to `text` with a `keyword` subfield for exact matching: `PUT my_index/_mapping { "properties": { "user.name": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } } } }`.
Change the field type to `text` with a `keyword` subfield for exact matching: `PUT my_index/_mapping { "properties": { "user.name": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } } } }`. -
85% success Truncate the field value at the application level before indexing to ensure it stays under 32766 bytes.
Truncate the field value at the application level before indexing to ensure it stays under 32766 bytes.
-
88% success Use a `keyword` field with `ignore_above` set to a value less than 32766 to skip indexing long values.
Use a `keyword` field with `ignore_above` set to a value less than 32766 to skip indexing long values.
中文步骤
将字段类型更改为 `text` 并添加 `keyword` 子字段用于精确匹配:`PUT my_index/_mapping { "properties": { "user.name": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } } } }`。在应用程序级别截断字段值,确保其小于 32766 字节后再索引。
使用带有 `ignore_above` 设置的 `keyword` 字段,设置值小于 32766 以跳过索引长值。
Dead Ends
Common approaches that don't work:
-
80% fail
`ignore_above` truncates the field, it does not increase the keyword length limit.
-
90% fail
Removing `ignore_above` does not change the hard byte limit for keyword fields.
-
85% fail
Reindexing without addressing the field type will still reject large values.