# Parent child relationship

**URL:** <https://discuss.elastic.co/t/parent-child-relationship/7978>\
**Category:** Elasticsearch\
**Created:** [June 5, 2012, 10:54am UTC](https://discuss.elastic.co/t/parent-child-relationship/7978 "2012-06-05T10:54:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vipul](https://avatars.discourse-cdn.com/v4/letter/v/cdc98d/32.png) [@Vipul](https://discuss.elastic.co/u/Vipul)\
**Post date:** [June 5, 2012, 10:54am UTC](https://discuss.elastic.co/t/parent-child-relationship/7978/1 "2012-06-05T10:54:43Z")

</div>

My mapping is as follows:

"copy\_order\_snapshot": {  
"properties": {  
"line\_item\_info": {  
"dynamic": "true",  
"properties": {  
"m\_product\_details": {  
"dynamic": "true",  
"properties": {  
"accessories\_colour": {  
"type": "string"  
},  
"accessories\_material\_type": {  
"type": "string"  
},  
"accessories\_sizes": {  
"type": "string"  
},  
"aitmanufacturers\_sort": {  
"type": "string"  
},  
"assigned\_to": {  
"type": "string"  
},  
"attribute\_set\_id": {  
"type": "string"  
}  
}  
},  
"meta\_group\_type": {  
"dynamic": "true",  
"properties": {  
"CATEGORY": {  
"type": "string"  
},  
"PRODUCT\_GROUP": {  
"type": "string"  
},  
"PRODUCT\_TYPE": {  
"type": "string"  
},  
"SKU\_ID": {  
"type": "string"  
},  
"prod\_id": {  
"type": "string"  
}  
}  
},  
"order\_details": {  
"dynamic": "true",  
"properties": {  
"amount\_refunded": {  
"type": "string"  
},  
"item\_id": {  
"type": "string"  
},  
"name": {  
"type": "string"  
},  
"order\_id": {  
"type": "string"  
}  
}  
},

```
            "product_details": {
                "dynamic": "true",
                "properties": {
                    "attribute_set_id": {
                        "type": "string"
                    }
                }
            },
            "supplier_details": {
                "dynamic": "true",
                "properties": {
                    "Name": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    }
                }
            }
        }
    },
    "order_data": {
        "dynamic": "true",
        "properties": {
            "entity_id": {
                "type": "string"
            }
        }
    },
    "order_id": {
        "type": "string"
    },
}

```

}

Now here for a particular order , there may be many items. I want a parent child relationship between every item corresponding to a particular order. In other words, there would be an array of line\_item\_info for each item per order. Also everything except line\_item\_info is same for all items in a particular order. I want to index line\_item\_info in such a way that each item is treated separately but at the same time maintains a relationship with its parent order.

---

<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:25am UTC](https://discuss.elastic.co/t/parent-child-relationship/7978/2 "2017-07-06T03:25:37Z")

</div>

Closed on July 6, 2017, 3:25am UTC


