# Error in using dynamic mapping: Elasticsearch 6.2

**URL:** <https://discuss.elastic.co/t/error-in-using-dynamic-mapping-elasticsearch-6-2/133699>\
**Category:** Elasticsearch\
**Created:** [May 29, 2018, 2:34pm UTC](https://discuss.elastic.co/t/error-in-using-dynamic-mapping-elasticsearch-6-2/133699 "2018-05-29T14:34:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aditya7](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@aditya7](https://discuss.elastic.co/u/aditya7)\
**Post date:** [May 29, 2018, 2:34pm UTC](https://discuss.elastic.co/t/error-in-using-dynamic-mapping-elasticsearch-6-2/133699/1 "2018-05-29T14:34:12Z")

</div>

I have upgraded to Elasticsearch 6.2 from 5.0. I am facing challenges in dynamic template.  
Template I have uploaded to ES is:

> curl -XPOST localhost:9200/\_template/mytemplate -H 'Content-Type: application/json' -d'  
> {  
> "index\_patterns": [  
> "my\*"  
> ],  
> "settings": {  
> "number\_of\_shards": 2  
> },  
> "mappings": {  
> "mytype": {  
> "dynamic\_templates": [  
> {  
> "string\_fields": {  
> "match\_mapping\_type": "string",  
> "match": "\*",  
> "mapping": {  
> "index": "not\_analyzed",  
> "ignore\_above": 256,  
> "type": "string"  
> }  
> }  
> }  
> ],  
> "properties":{  
> "createdAt":{  
> "type":"date",  
> "format": "epoch\_millis"  
> }  
> }  
> }  
> }  
> }'

The template is successfully loaded into elasticsearch. But when I am trying to load data into elasticSearch, its throwing following error:

> {  
> "error": {  
> "root\_cause": [  
> {  
> "type": "mapper\_parsing\_exception",  
> "reason": "failed to find type parsed [string] for [fname]"  
> }  
> ],  
> "type": "mapper\_parsing\_exception",  
> "reason": "failed to find type parsed [string] for [fname]"  
> },  
> "status": 400  
> }

Data i am trying to load:

> {  
> "fname":"aditya",  
> "lname":"prateek",  
> "createdAt":1527602481459  
> }

Also, I have tried giving

> "mapping": {  
> "index": "not\_analyzed",  
> "ignore\_above": 256,  
> "type": "keyword"  
> }

But, I am getting another error: **"Failed to parse value [not\_analyzed] as only [true] or [false] are allowed."**

Am I doing anything wrong here?

---

<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:** [May 29, 2018, 9:15pm UTC](https://discuss.elastic.co/t/error-in-using-dynamic-mapping-elasticsearch-6-2/133699/2 "2018-05-29T21:15:56Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

Instead of `string`, use `text`.  
Instead of `"index": "not_analyzed"`, you can either use `keyword` datatype (instead of `text`) or use `"analyzer": "keyword"`.

HTH

---

<div class="post-metadata">

**Author:** ![aditya7](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@aditya7](https://discuss.elastic.co/u/aditya7)\
**Post date:** [May 30, 2018, 6:47am UTC](https://discuss.elastic.co/t/error-in-using-dynamic-mapping-elasticsearch-6-2/133699/3 "2018-05-30T06:47:55Z")

</div>

Thanks David. I have modified the mapping to:

```
"mapping": {
      "ignore_above": 256,
       "type": "keyword"
}

```

Now its working fine. 🙂

---

<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:** [June 27, 2018, 6:48am UTC](https://discuss.elastic.co/t/error-in-using-dynamic-mapping-elasticsearch-6-2/133699/4 "2018-06-27T06:48:03Z")

</div>

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