# Mapping with nested data

**URL:** <https://discuss.elastic.co/t/mapping-with-nested-data/93332>\
**Category:** Elasticsearch\
**Created:** [July 17, 2017, 5:26am UTC](https://discuss.elastic.co/t/mapping-with-nested-data/93332 "2017-07-17T05:26:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhishek5678](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@abhishek5678](https://discuss.elastic.co/u/abhishek5678)\
**Post date:** [July 17, 2017, 5:26am UTC](https://discuss.elastic.co/t/mapping-with-nested-data/93332/1 "2017-07-17T05:26:14Z")

</div>

Hi Everyone,  
I have some nested data. I want to perform the mapping on this data but I am not able to get the correct mapping.  
I have data like that:

Data:  
POST /icd10cmindex/icd10/1  
{  
"version": "2018",  
"title": "ICD-10-CM INDEX TO DISEASES and INJURIES",  
"letter": [  
{  
"title": "A",  
"mainTerm": [  
{  
"title": "Aarskog's syndrome",  
"code": "Q87.1"  
},  
{  
"title": "Abandonment",  
"see": "Maltreatment"  
},  
{  
"title": {  
"#text": "Abasia",  
"nemod": "(-astasia) (hysterical)"  
},  
"code": "F44.4"  
},  
{  
"title": {  
"#text": "Abderhalden-Kaufmann-Lignac syndrome",  
"nemod": "(cystinosis)"  
},  
"code": "E72.04"  
},  
{  
"title": "Abdomen, abdominal",  
"seeAlso": "condition",  
"term": [  
{  
"-level": "1",  
"title": "acute",  
"code": "R10.0"  
},  
{  
"-level": "1",  
"title": "angina",  
"code": "K55.1"  
},  
{  
"-level": "1",  
"title": "muscle deficiency syndrome",  
"code": "Q79.4"  
}  
]  
}  
]  
}  
]  
}

I am applying the mapping like that:  
Mapping:  
PUT /icd10cmindex  
{  
"mappings" : {  
"icd10" : {  
"properties" : {  
"version": {  
"type": "string"  
},  
"title":{  
"type":"string"  
},  
"letter": {  
"type": "nested",  
"properties": {  
"title": {  
"type": "string"  
},  
"mainTerm": {  
"type": "nested",  
"properties": {  
"code": {  
"type": "string"  
},  
"see": {  
"type": "string"  
},  
"title": {  
"type": "string"  
},  
"term": {  
"type": "nested",  
"properties": {  
"-level": {  
"type": "long"  
},  
"title": {  
"type": "string"  
},  
"code": {  
"type": "string"  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}  
}

Actually the problem is when I am applying the query then I am not able to get the title field [data.so](http://data.so) provide me the correct mapping for this data.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 17, 2017, 5:29am UTC](https://discuss.elastic.co/t/mapping-with-nested-data/93332/2 "2017-07-17T05:29:14Z")

</div>

@abhishek5678 This seem to be a duplicate of [Problem with Nested Data Inside the Objects Data](https://discuss.elastic.co/t/problem-with-nested-data-inside-the-objects-data/92936).

Please keep the discussion around a single issue to a single thread.

---

<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:** [August 14, 2017, 5:29am UTC](https://discuss.elastic.co/t/mapping-with-nested-data/93332/3 "2017-08-14T05:29:28Z")

</div>

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