# Failed to index texts with lengths above 32766

**URL:** <https://forum.opensearch.org/t/failed-to-index-texts-with-lengths-above-32766/26320>\
**Category:** OpenSearch\
**Tags:** index-management\
**Created:** [August 11, 2025, 7:13pm UTC](https://forum.opensearch.org/t/failed-to-index-texts-with-lengths-above-32766/26320 "2025-08-11T19:13:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![summerist.l](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@summerist.l](https://forum.opensearch.org/u/summerist.l)\
**Post date:** [August 11, 2025, 7:13pm UTC](https://forum.opensearch.org/t/failed-to-index-texts-with-lengths-above-32766/26320/1 "2025-08-11T19:13:20Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):  
“version” : {  
“distribution” : “opensearch”,  
“number” : “3.1.0”,  
“build\_type” : “tar”,  
“build\_hash” : “8ff7c6ee924a49f0f59f80a6e1c73073c8904214”,  
“build\_date” : “2025-06-21T08:05:43.345081313Z”,  
“build\_snapshot” : false,  
“lucene\_version” : “10.2.1”,  
“minimum\_wire\_compatibility\_version” : “2.19.0”,  
“minimum\_index\_compatibility\_version” : “2.0.0”

**Describe the issue:**

Failed to index any text longer than 32766. The error is like:

> ERROR: **main** :Error 1: {‘index’: {‘\_index’: ‘table1’, ‘\_id’: ‘123456789’, ‘status’: 400, ‘error’: {‘type’: ‘not\_x\_content\_exception’, ‘reason’: ‘Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes’}}}

Any idea how to solve it? I would like to avoid truncating text if possible.

---

<div class="post-metadata">

**Author:** ![Leeroy](https://avatars.discourse-cdn.com/v4/letter/l/eb9ed0/32.png) [@Leeroy](https://forum.opensearch.org/u/Leeroy)\
**Post date:** [August 11, 2025, 8:47pm UTC](https://forum.opensearch.org/t/failed-to-index-texts-with-lengths-above-32766/26320/2 "2025-08-11T20:47:52Z")

</div>

hey @summerist.l ,

Have you a sample of what you’re trying to send and from what is sending it?

Leeroy.

---

<div class="post-metadata">

**Author:** ![summerist.l](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@summerist.l](https://forum.opensearch.org/u/summerist.l)\
**Post date:** [August 12, 2025, 12:09pm UTC](https://forum.opensearch.org/t/failed-to-index-texts-with-lengths-above-32766/26320/3 "2025-08-12T12:09:14Z")

</div>

@Leeroy Thank you for the reply! I am not able to share the original text but it is just user reviews in plain text, no emoji no special characters, totally UTF8 compatible. I have done a bunch of tests so it is only related to text length.

---

<div class="post-metadata">

**Author:** ![summerist.l](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@summerist.l](https://forum.opensearch.org/u/summerist.l)\
**Post date:** [August 12, 2025, 12:30pm UTC](https://forum.opensearch.org/t/failed-to-index-texts-with-lengths-above-32766/26320/4 "2025-08-12T12:30:50Z")

</div>

Solved. The reason of the error is that I defined the text field as ‘keyword‘ in index schema like this:

> ```
> "extracted_text": {
> 
> "type": "text",
> 
> "analyzer": "custom_text_analyzer",
> 
> "fields": {
> 
> "keyword": {"type": "keyword"}
> 
> }
> 
> },
> 
> ```

and Lucene has a maximum term length limit of 32766 on ‘keyword’ type. The error went away once you removed the ‘fields‘ key pair in schema. It won’t affect hybrid search at all.
