# Nested mapping strategy

**URL:** <https://discuss.elastic.co/t/nested-mapping-strategy/8406>\
**Category:** Elasticsearch\
**Created:** [July 13, 2012, 2:02pm UTC](https://discuss.elastic.co/t/nested-mapping-strategy/8406 "2012-07-13T14:02:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinicius\_Carvalho](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinicius_carvalho/32/770_2.png) [@Vinicius\_Carvalho](https://discuss.elastic.co/u/Vinicius_Carvalho)\
**Post date:** [July 13, 2012, 2:02pm UTC](https://discuss.elastic.co/t/nested-mapping-strategy/8406/1 "2012-07-13T14:02:19Z")

</div>

Hi there! I'm choosing between a single index with a nested object or  
splitting it on several index, and flatten the object. In the past using  
Solr and Lucene I followed the flatten strategy, but ES seems to be really  
powerful in handling complex json objects.

One issue I could not figure yet is how you would tell which field was  
found when a doc was hit using a nested strategy. For instance:

{  
id:14567  
artist : {  
name: Iron Maiden  
albums: [  
{  
album: {  
name:Powerslave  
tracks: [  
{  
track: { name: Powerslave  
...}}}

So, when a user searches for Powerslave it would find the document 14567,  
which is the artist Iron Maiden, but I'd like to suggest that it found an  
album and a song named Powerslave. Is there an easy way of doing this? Or  
flattening and doing a multi index search would be a better approach?

Regards

---

<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:** [July 6, 2017, 3:20am UTC](https://discuss.elastic.co/t/nested-mapping-strategy/8406/2 "2017-07-06T03:20:22Z")

</div>


