# Wrong dynamic mapping in Elasticsearch 8.11 prevents indexation of arrays of more than 127 strings

**URL:** <https://discuss.elastic.co/t/wrong-dynamic-mapping-in-elasticsearch-8-11-prevents-indexation-of-arrays-of-more-than-127-strings/346803>\
**Category:** Elasticsearch\
**Tags:** docker, vector-search\
**Created:** [November 9, 2023, 1:58pm UTC](https://discuss.elastic.co/t/wrong-dynamic-mapping-in-elasticsearch-8-11-prevents-indexation-of-arrays-of-more-than-127-strings/346803 "2023-11-09T13:58:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JulienCarnec](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@JulienCarnec](https://discuss.elastic.co/u/JulienCarnec)\
**Post date:** [November 9, 2023, 1:58pm UTC](https://discuss.elastic.co/t/wrong-dynamic-mapping-in-elasticsearch-8-11-prevents-indexation-of-arrays-of-more-than-127-strings/346803/1 "2023-11-09T13:58:54Z")

</div>

Since 8.11.0, when using dynamic mapping, there is a defect preventing the indexation of documents with an array field containing more than 127 strings.

Here is how to reproduce:

1- start Elasticsearch 8.11.0:

```auto
docker run -p 9201:9200 -it -m 1GB -e xpack.security.enabled=false -e discovery.type=single-node docker.elastic.co/elasticsearch/elasticsearch:8.11.0

```

2- create an index

```auto
PUT /testindex
body: {}

```

3- try to insert this doc:

```auto
PUT /testindex/_doc/foo
body:
{
  "list": [
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo"]
}

```

Elasticsearch fails as follows

```auto
{
  "error":{
    "root_cause":[
      {
        "type":"parsing_exception",
        "reason":"Failed to parse object: expecting token of type [VALUE_NUMBER] but found [VALUE_STRING]",
        "line":1,
        "col":10
      }
    ],
    "type":"document_parsing_exception",
    "reason":"[1:10] failed to parse: Failed to parse object: expecting token of type [VALUE_NUMBER] but found [VALUE_STRING]",
    "caused_by":{
      "type":"parsing_exception",
      "reason":"Failed to parse object: expecting token of type [VALUE_NUMBER] but found [VALUE_STRING]",
      "line":1,
      "col":10
    }
  },
  "status":400
}

```

And in the mappings, you see this new mapping created:

```auto
"mappings": {
  "_doc": {
    "properties": {
      "list": {
        "dims": 128,
        "similarity": "cosine",
        "index": true,
        "type": "dense_vector"
      }
    }
  }
},

```

Instead we should have the same mapping as in previous versions:

```auto
"mappings": {
  "_doc": {
    "properties": {
      "list": {
        "type": "text",
        "fields": {
          "keyword": {
            "ignore_above": 256,
            "type": "keyword"
         }
       }
    }
  }
},

```

If the array contains less than 128 items, the indexation works fine.

Is it a defect or a new undocumented limitation?

---

<div class="post-metadata">

**Author:** ![BenTrent](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bentrent/32/33915_2.png) [@BenTrent](https://discuss.elastic.co/u/BenTrent)\
**Post date:** [November 9, 2023, 2:12pm UTC](https://discuss.elastic.co/t/wrong-dynamic-mapping-in-elasticsearch-8-11-prevents-indexation-of-arrays-of-more-than-127-strings/346803/2 "2023-11-09T14:12:44Z")

</div>

Yep, looks like a bug! Thank you @JulienCarnec for finding it!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 9, 2023, 2:13pm UTC](https://discuss.elastic.co/t/wrong-dynamic-mapping-in-elasticsearch-8-11-prevents-indexation-of-arrays-of-more-than-127-strings/346803/3 "2023-11-09T14:13:59Z")

</div>

Thanks for reporting this.  
I can indeed reproduce this behavior. It's a bug to me but let me ask the team 😉

Merci Julien 🙂

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 9, 2023, 2:14pm UTC](https://discuss.elastic.co/t/wrong-dynamic-mapping-in-elasticsearch-8-11-prevents-indexation-of-arrays-of-more-than-127-strings/346803/4 "2023-11-09T14:14:58Z")

</div>

Ha! @BenTrent is already on it 😉

Here is the full script BTW:

```auto
DELETE /testindex
PUT /testindex
PUT /testindex/_doc/foo
{
  "list": [
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo",
    "foo", "foo", "foo", "foo", "foo", "foo", "foo", "foo"]
}
GET /testindex/_mapping

```

---

<div class="post-metadata">

**Author:** ![BenTrent](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bentrent/32/33915_2.png) [@BenTrent](https://discuss.elastic.co/u/BenTrent)\
**Post date:** [November 9, 2023, 2:24pm UTC](https://discuss.elastic.co/t/wrong-dynamic-mapping-in-elasticsearch-8-11-prevents-indexation-of-arrays-of-more-than-127-strings/346803/5 "2023-11-09T14:24:54Z")

</div>

Here is a github issue tracking the bug: [Array of strings incorrectly indexed as `dense_vector` · Issue #101965 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/101965)

Getting it addressed ASAP!

---

<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:** [December 7, 2023, 2:25pm UTC](https://discuss.elastic.co/t/wrong-dynamic-mapping-in-elasticsearch-8-11-prevents-indexation-of-arrays-of-more-than-127-strings/346803/6 "2023-12-07T14:25:01Z")

</div>

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