# Bytes can be at most 32766 in length got 36716

**URL:** <https://discuss.elastic.co/t/bytes-can-be-at-most-32766-in-length-got-36716/267463>\
**Category:** Kibana\
**Tags:** reindex\
**Created:** [March 17, 2021, 9:49am UTC](https://discuss.elastic.co/t/bytes-can-be-at-most-32766-in-length-got-36716/267463 "2021-03-17T09:49:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajaythakor](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@ajaythakor](https://discuss.elastic.co/u/ajaythakor)\
**Post date:** [March 17, 2021, 9:49am UTC](https://discuss.elastic.co/t/bytes-can-be-at-most-32766-in-length-got-36716/267463/1 "2021-03-17T09:49:38Z")

</div>

I have created new index named `tbxmlcs`

Then I have added mapping:

```auto
{
  "properties": {
    "34084-4": { 
      "type": "keyword",
      "fields": {
        "keyword":{  
            "type":"keyword",
            "ignore_above": 256
        }
      }
    }
  }
}

After that I tried to get some filtered data from old index to the new index:

POST _reindex
{
  "source": {
    "index": "tbxmlfile",
    "query": {
      "bool": {
        "must": [
          {
            "terms": {
              "34084-4": [
                "copd"
              ]
            }
          }
        ]
      }
    }
  },
  "dest": {
    "index": "tbxmlcs"
  }
}

I am getting below error message:

{
  "took" : 4503,
  "timed_out" : false,
  "total" : 183,
  "updated" : 154,
  "created" : 0,
  "deleted" : 0,
  "batches" : 1,
  "version_conflicts" : 0,
  "noops" : 0,
  "retries" : {
    "bulk" : 0,
    "search" : 0
  },
  "throttled_millis" : 0,
  "requests_per_second" : -1.0,
  "throttled_until_millis" : 0,
  "failures" : [
    {
      "index" : "tbxmlcs",
      "type" : "_doc",
      "id" : "z8cqgXcBwCxB52uVeNre",
      "cause" : {
        "type" : "illegal_argument_exception",
        "reason" : "Document contains at least one immense term in field=\"34084-4\" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped. Please correct the analyzer to not produce such terms. The prefix of the first immense term is: '[60, 115, 101, 99, 116, 105, 111, 110, 32, 73, 68, 61, 34, 98, 49, 53, 101, 53, 97, 101, 56, 45, 51, 48, 97, 49, 45, 52, 98, 102]...', original message: bytes can be at most 32766 in length; got 36716",
        "caused_by" : {
          "type" : "max_bytes_length_exceeded_exception",
          "reason" : "bytes can be at most 32766 in length; got 36716"
        }
      },
      "status" : 400
    }
}

I have tried increasing the memory of elastic search and also tried to update zones, still the same issue.

I want to use case-sensitive search: for example my field `34084-4` should search only COLD but not Cold or cold or any other combination.
I have tried for exact match also, still, it did not work.
I dont want to reload the data again with new mapping.

Can you please guide me through this.
```

---

<div class="post-metadata">

**Author:** ![Aaron\_Caldwell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron_caldwell/32/45755_2.png) [@Aaron\_Caldwell](https://discuss.elastic.co/u/Aaron_Caldwell)\
**Post date:** [March 17, 2021, 4:37pm UTC](https://discuss.elastic.co/t/bytes-can-be-at-most-32766-in-length-got-36716/267463/2 "2021-03-17T16:37:06Z")

</div>

Hello,

You might want to consider using a `text` mapping. For reference, see [this discuss thread](https://discuss.elastic.co/t/bytes-can-be-at-most-32766-in-length/213650).

Regards,  
Aaron

---

<div class="post-metadata">

**Author:** ![ajaythakor](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@ajaythakor](https://discuss.elastic.co/u/ajaythakor)\
**Post date:** [March 18, 2021, 5:21am UTC](https://discuss.elastic.co/t/bytes-can-be-at-most-32766-in-length-got-36716/267463/3 "2021-03-18T05:21:56Z")

</div>

Hi,

What should I do to allow more than 32767 for `keyword`.

I want to use case sensitive search. and its not allowing case sensitive search with text. or please let me know, if I am doing wrong.

---

<div class="post-metadata">

**Author:** ![ajaythakor](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@ajaythakor](https://discuss.elastic.co/u/ajaythakor)\
**Post date:** [March 19, 2021, 7:56am UTC](https://discuss.elastic.co/t/bytes-can-be-at-most-32766-in-length-got-36716/267463/4 "2021-03-19T07:56:36Z")

</div>

@Aaron will `text` mapping work for case-sensitive search?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 16, 2021, 7:57am UTC](https://discuss.elastic.co/t/bytes-can-be-at-most-32766-in-length-got-36716/267463/5 "2021-04-16T07:57:01Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
