# Dynamic mapping error - Unable to create dynamic object

**URL:** <https://discuss.elastic.co/t/dynamic-mapping-error-unable-to-create-dynamic-object/250755>\
**Category:** Elasticsearch\
**Created:** [October 2, 2020, 6:28am UTC](https://discuss.elastic.co/t/dynamic-mapping-error-unable-to-create-dynamic-object/250755 "2020-10-02T06:28:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![elastic78](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@elastic78](https://discuss.elastic.co/u/elastic78)\
**Post date:** [October 2, 2020, 6:28am UTC](https://discuss.elastic.co/t/dynamic-mapping-error-unable-to-create-dynamic-object/250755/1 "2020-10-02T06:28:09Z")

</div>

Hi,  
We are trying to migrate from 5.5.2. to 6.8.12 version.Below is the sample of my mapping. I have set my mapping to dynamic:strict and only one object I would want to introduce dynamically so setting it to true. This worked fine 5.5.2 but in 6.8.12 I am getting the below error. Can some one please help how to proceed.  
Error:  
[ElasticsearchException[Elasticsearch exception [type=strict\_dynamic\_mapping\_exception, reason=mapping set to strict, dynamic introduction of [5bd6fa70-0412-11eb-a292-8aa14da452bd] within [\_doc] is not allowed]]]  
Mapping:

```auto
{
    "dynamic":"strict",
    "properties":{
        "name":{
            "type":"text",
            "analyzer":"case_insensitive_analyzer",
            "fielddata":true
        },
        "location":{
            "type":"object",
            "dynamic":"true"
        }
}
}

```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 2, 2020, 11:08am UTC](https://discuss.elastic.co/t/dynamic-mapping-error-unable-to-create-dynamic-object/250755/2 "2020-10-02T11:08:56Z")

</div>

please always share the whole request, including URL and HTTP verb. Thank you!

---

<div class="post-metadata">

**Author:** ![elastic78](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@elastic78](https://discuss.elastic.co/u/elastic78)\
**Post date:** [October 2, 2020, 8:40pm UTC](https://discuss.elastic.co/t/dynamic-mapping-error-unable-to-create-dynamic-object/250755/3 "2020-10-02T20:40:42Z")

</div>

We insert using BulkProcessor JAVA API and use RESTHttpClient([http://localhost:9200](http://localhost:9200))

```auto
Map<String, Object> map = new HashMap<>();|
map.putAll("attributes1");-->other fields in schema
map.putAll("attributes");---> this is the attribute lcoation with dynamic true
	esBulkProcessor.processRequest(new UpdateRequest(index,_doc,key).doc(map).upsert( new IndexRequest(index).id(key).source(map)));

@SuppressWarnings("rawtypes")
public synchronized void processRequest(DocWriteRequest request) {
bulkProcessor .add(request);
}

```

Let me know if you need anything. Thanks for the response.

---

<div class="post-metadata">

**Author:** ![elastic78](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@elastic78](https://discuss.elastic.co/u/elastic78)\
**Post date:** [October 2, 2020, 9:28pm UTC](https://discuss.elastic.co/t/dynamic-mapping-error-unable-to-create-dynamic-object/250755/4 "2020-10-02T21:28:39Z")

</div>

this is the log file  
in bulkadd update {[indexname][\_doc][keyname], doc\_as\_upsert[false], doc[index {[null][null][null], source[{“name”:”Ben”,”5bd6fa70-0412-11eb-a292-8aa14da452bd":"test123"}]}], upsert[index {[indexname][null][keyname], source[{“name”:”Ben”,”5bd6fa70-0412-11eb-a292-8aa14da452bd":"test123","StaticGroupAssignment":"true","esLastUpdateTime":"1601576338394"}]}], scripted\_upsert[false], detect\_noop[true]}

2020-10-01 18:18:58,544 DEBUG [admin-http-pool1] com.sample.ESBulkProcessor -:admin:-1130555730:::- Elasticsearch bulk processor flush invoked

2020-10-01 18:18:58,564 DEBUG [I/O dispatcher 3] org.elasticsearch.client.RestClient -:::::- request [POST [http://localhost:9200/contextrepo/\_refresh?ignore\_throttled=false&ignore\_unavailable=false&expand\_wildcards=open&allow\_no\_indices=true](http://localhost:9200/contextrepo/_refresh?ignore_throttled=false&ignore_unavailable=false&expand_wildcards=open&allow_no_indices=true)] returned [HTTP/1.1 200 OK]

2020-10-01 18:18:58,566 DEBUG [admin-http-pool1] com.sample.base.ESClient -:admin:-1130555730:::- Referesh executed10

2020-10-01 18:18:58,581 DEBUG [I/O dispatcher 1] org.elasticsearch.client.RestClient -:::::- request [POST [http://localhost:9200/\_bulk?timeout=1m](http://localhost:9200/_bulk?timeout=1m)] returned [HTTP/1.1 200 OK]

[0]: index [indexname], type [\_doc], id [keyname], message [ElasticsearchException[Elasticsearch exception [type=strict\_dynamic\_mapping\_exception, reason=mapping set to strict, dynamic introduction of [5bd6fa70-0412-11eb-a292-8aa14da452bd] within [\_doc] is not allowed]]]

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 5, 2020, 9:00am UTC](https://discuss.elastic.co/t/dynamic-mapping-error-unable-to-create-dynamic-object/250755/5 "2020-10-05T09:00:32Z")

</div>

Are you trying to set a different `_doc` type as it is set in the index? Can you try to omit it?

---

<div class="post-metadata">

**Author:** ![elastic78](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@elastic78](https://discuss.elastic.co/u/elastic78)\
**Post date:** [October 5, 2020, 5:06pm UTC](https://discuss.elastic.co/t/dynamic-mapping-error-unable-to-create-dynamic-object/250755/6 "2020-10-05T17:06:30Z")

</div>

Thank you Alexander. I was able to fix this issue. They way we were updating the dynamic attributes had an issue. Fixed that. Thanks for your suggestions

---

<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:** [November 2, 2020, 5:06pm UTC](https://discuss.elastic.co/t/dynamic-mapping-error-unable-to-create-dynamic-object/250755/7 "2020-11-02T17:06:36Z")

</div>

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