# Creating Parent-Child Mapping with Java API in ES 2.2

**URL:** <https://discuss.elastic.co/t/creating-parent-child-mapping-with-java-api-in-es-2-2/45638>\
**Category:** Elasticsearch\
**Created:** [March 29, 2016, 1:36am UTC](https://discuss.elastic.co/t/creating-parent-child-mapping-with-java-api-in-es-2-2/45638 "2016-03-29T01:36:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulavijit](https://avatars.discourse-cdn.com/v4/letter/p/858c86/32.png) [@paulavijit](https://discuss.elastic.co/u/paulavijit)\
**Post date:** [March 29, 2016, 1:36am UTC](https://discuss.elastic.co/t/creating-parent-child-mapping-with-java-api-in-es-2-2/45638/1 "2016-03-29T01:36:20Z")

</div>

How can I create the following Parent-Child Mapping using Java API:

PUT karaf-2016.03.28  
{  
"mappings": {  
"karaf\_event": {  
"properties": {  
"HRC\_ROUTE\_ID": {  
"type": "string",  
"index": "not\_analyzed"  
},  
"@timestamp": {  
"type": "date",  
"format": "strict\_date\_optional\_time||epoch\_millis"  
}  
}  
},  
"karaf\_event\_headers": {  
"\_parent": {  
"type": "karaf\_event"  
},  
"properties": {  
"HRC\_HEADER\_NAME": {  
"type": "string",  
"index": "not\_analyzed"  
},  
"HRC\_HEADER\_VALUE": {  
"type": "string",  
"index": "not\_analyzed"  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![paulavijit](https://avatars.discourse-cdn.com/v4/letter/p/858c86/32.png) [@paulavijit](https://discuss.elastic.co/u/paulavijit)\
**Post date:** [March 29, 2016, 1:29pm UTC](https://discuss.elastic.co/t/creating-parent-child-mapping-with-java-api-in-es-2-2/45638/2 "2016-03-29T13:29:16Z")

</div>

Please help with this issue.

> [@paulavijit](#):
>
> How can I create the following Parent-Child Mapping using Java API:
> 
> PUT karaf-2016.03.28  
> {  
> "mappings": {  
> "karaf\_event": {  
> "properties": {  
> "HRC\_ROUTE\_ID": {  
> "type": "string",  
> "index": "not\_analyzed"  
> },  
> "@timestamp": {  
> "type": "date",  
> "format": "strict\_date\_optional\_time||epoch\_millis"  
> }  
> }  
> },  
> "karaf\_event\_headers": {  
> "\_parent": {  
> "type": "karaf\_event"  
> },  
> "properties": {  
> "HRC\_HEADER\_NAME": {  
> "type": "string",  
> "index": "not\_analyzed"  
> },  
> "HRC\_HEADER\_VALUE": {  
> "type": "string",  
> "index": "not\_analyzed"  
> }  
> }  
> }  
> }  
> }

---

<div class="post-metadata">

**Author:** ![paulavijit](https://avatars.discourse-cdn.com/v4/letter/p/858c86/32.png) [@paulavijit](https://discuss.elastic.co/u/paulavijit)\
**Post date:** [March 30, 2016, 8:41pm UTC](https://discuss.elastic.co/t/creating-parent-child-mapping-with-java-api-in-es-2-2/45638/3 "2016-03-30T20:41:09Z")

</div>

Is this something possible in ES 2.2???

> [@paulavijit](#):
>
> How can I create the following Parent-Child Mapping using Java API:
> 
> PUT karaf-2016.03.28  
> {  
> "mappings": {  
> "karaf\_event": {  
> "properties": {  
> "HRC\_ROUTE\_ID": {  
> "type": "string",  
> "index": "not\_analyzed"  
> },  
> "@timestamp": {  
> "type": "date",  
> "format": "strict\_date\_optional\_time||epoch\_millis"  
> }  
> }  
> },  
> "karaf\_event\_headers": {  
> "\_parent": {  
> "type": "karaf\_event"  
> },  
> "properties": {  
> "HRC\_HEADER\_NAME": {  
> "type": "string",  
> "index": "not\_analyzed"  
> },  
> "HRC\_HEADER\_VALUE": {  
> "type": "string",  
> "index": "not\_analyzed"  
> }  
> }  
> }  
> }  
> }

---

<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 5, 2017, 11:03pm UTC](https://discuss.elastic.co/t/creating-parent-child-mapping-with-java-api-in-es-2-2/45638/4 "2017-07-05T23:03:52Z")

</div>


