Dynamic mapping error - Unable to create dynamic object

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.
[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]]]


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

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

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)));

public synchronized void processRequest(DocWriteRequest request) {
bulkProcessor .add(request);

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

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] 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] 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]]]

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

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

1 Like

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