# Better way to convert the object field to nested type field

**URL:** https://discuss.elastic.co/t/better-way-to-convert-the-object-field-to-nested-type-field/263026
**Category:** Elasticsearch
**Created:** [February 2, 2021, 6:14pm UTC](https://discuss.elastic.co/t/better-way-to-convert-the-object-field-to-nested-type-field/263026 "2021-02-02T18:14:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Prabaharan\_Kathiresa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prabaharan_kathiresa/32/49232_2.png) [@Prabaharan\_Kathiresa](https://discuss.elastic.co/u/Prabaharan_Kathiresa)
#### Post date: [February 2, 2021, 6:14pm UTC](https://discuss.elastic.co/t/better-way-to-convert-the-object-field-to-nested-type-field/263026/1 "2021-02-02T18:14:08Z")

</div>

Hi Team

We have an index with object field, we are planning to improve the object field into nested type (array of objects).

ie.

> {  
> "name": "Adam",  
> "car" : {  
> "name": "Maruthi",  
> "modelyear": "2005"  
> }  
> }

we are trying to store the documents from the above one to below one

> {  
> "name": "ABC",  
> "car" : [  
> {  
> "name": "Maruthi",  
> "modelyear": "2005"  
> },  
> {  
> "name": "HONDA",  
> "modelyear": "2008"  
> }  
> }

My Question is

1. if I do the search query with car.name="Maruthi" will return both documents? or one with nested type will return.

2. what should be the better way to update the existing index mapping? I see articles saying elastic will not support updating the existing index mapping.

My elastic server version is 6.8.5.

Team, any suggestions or any feedback on the question.

---

<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: [March 2, 2021, 6:14pm UTC](https://discuss.elastic.co/t/better-way-to-convert-the-object-field-to-nested-type-field/263026/2 "2021-03-02T18:14:22Z")

</div>

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