# Create nested mappings there is still an error

**URL:** <https://discuss.elastic.co/t/create-nested-mappings-there-is-still-an-error/273138>\
**Category:** Elasticsearch\
**Created:** [May 17, 2021, 7:46am UTC](https://discuss.elastic.co/t/create-nested-mappings-there-is-still-an-error/273138 "2021-05-17T07:46:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rizky\_Hudha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rizky_hudha/32/87736_2.png) [@Rizky\_Hudha](https://discuss.elastic.co/u/Rizky_Hudha)\
**Post date:** [May 17, 2021, 7:46am UTC](https://discuss.elastic.co/t/create-nested-mappings-there-is-still-an-error/273138/1 "2021-05-17T07:46:22Z")

</div>

hallo, can you help me with this problem

> PUT office  
> {  
> "mappings": {  
> "departments" : [{  
> "properties":{  
> "id":{  
> "type":"integer"  
> },  
> "deptName":{  
> "type":"string"  
> },  
> "employee\_details":{  
> "type":"nested",  
> "properties":{  
> "empId":{  
> "type":"integer"  
> },  
> "empName":{  
> "type":"string"  
> }  
> }  
> }  
> }  
> }  
> ]  
> }  
> }

and this error

> {  
> "error" : {  
> "root\_cause" : [  
> {  
> "type" : "mapper\_parsing\_exception",  
> "reason" : "Root mapping definition has unsupported parameters: [departments : [{properties={deptName={type=string}, employee\_details={type=nested, properties={empId={type=integer}, empName={type=string}}}, id={type=integer}}}]]"  
> }  
> ],  
> "type" : "mapper\_parsing\_exception",  
> "reason" : "Failed to parse mapping [\_doc]: Root mapping definition has unsupported parameters: [departments : [{properties={deptName={type=string}, employee\_details={type=nested, properties={empId={type=integer}, empName={type=string}}}, id={type=integer}}}]]",  
> "caused\_by" : {  
> "type" : "mapper\_parsing\_exception",  
> "reason" : "Root mapping definition has unsupported parameters: [departments : [{properties={deptName={type=string}, employee\_details={type=nested, properties={empId={type=integer}, empName={type=string}}}, id={type=integer}}}]]"  
> }  
> },  
> "status" : 400  
> }

---

<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 17, 2021, 8:07am UTC](https://discuss.elastic.co/t/create-nested-mappings-there-is-still-an-error/273138/2 "2021-05-17T08:07:58Z")

</div>

You need to remove:

```
"departments" : [{

```

And

```
}
]
```

---

<div class="post-metadata">

**Author:** ![Rizky\_Hudha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rizky_hudha/32/87736_2.png) [@Rizky\_Hudha](https://discuss.elastic.co/u/Rizky_Hudha)\
**Post date:** [May 17, 2021, 8:24am UTC](https://discuss.elastic.co/t/create-nested-mappings-there-is-still-an-error/273138/3 "2021-05-17T08:24:06Z")

</div>

I have tried to delete it but it keeps getting an error like this

> {  
> "error" : {  
> "root\_cause" : [  
> {  
> "type" : "mapper\_parsing\_exception",  
> "reason" : "No handler for type [string] declared on field [deptName]"  
> }  
> ],  
> "type" : "mapper\_parsing\_exception",  
> "reason" : "Failed to parse mapping [\_doc]: No handler for type [string] declared on field [deptName]",  
> "caused\_by" : {  
> "type" : "mapper\_parsing\_exception",  
> "reason" : "No handler for type [string] declared on field [deptName]"  
> }  
> },  
> "status" : 400  
> }

---

<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 17, 2021, 8:39am UTC](https://discuss.elastic.co/t/create-nested-mappings-there-is-still-an-error/273138/4 "2021-05-17T08:39:36Z")

</div>

Change `string` to `text`.

Also 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
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.  
Please update your post.

---

<div class="post-metadata">

**Author:** ![Rizky\_Hudha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rizky_hudha/32/87736_2.png) [@Rizky\_Hudha](https://discuss.elastic.co/u/Rizky_Hudha)\
**Post date:** [May 17, 2021, 10:35am UTC](https://discuss.elastic.co/t/create-nested-mappings-there-is-still-an-error/273138/5 "2021-05-17T10:35:33Z")

</div>

oke thx for your solution

---

<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 14, 2021, 10:35am UTC](https://discuss.elastic.co/t/create-nested-mappings-there-is-still-an-error/273138/6 "2021-06-14T10:35:41Z")

</div>

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