# Could someone help me ? --How to implement join datatype by Java API

**URL:** https://discuss.elastic.co/t/could-someone-help-me-how-to-implement-join-datatype-by-java-api/148781
**Category:** Elasticsearch
**Created:** [September 17, 2018, 7:39am UTC](https://discuss.elastic.co/t/could-someone-help-me-how-to-implement-join-datatype-by-java-api/148781 "2018-09-17T07:39:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Tina](https://avatars.discourse-cdn.com/v4/letter/t/48db29/32.png) [@Tina](https://discuss.elastic.co/u/Tina)
#### Post date: [September 17, 2018, 7:39am UTC](https://discuss.elastic.co/t/could-someone-help-me-how-to-implement-join-datatype-by-java-api/148781/1 "2018-09-17T07:39:43Z")

</div>

As the mapping type will be removed, so we plan to use the join datatype for parent/child doc, but I don't know which Java api should be used, could someone help provide below function by Java code ? thank you in advance.

```auto
PUT my_index { "mappings": { "_doc": { "properties": { "my_join_field": { "type": "join", "relations": { "question": "answer" } } } } } }

PUT my_index/_doc/1?refresh { "text": "This is a question", "my_join_field": { "name": "question" } }

PUT my_index/_doc/3?routing=1&amp;refresh { "text": "This is an answer", "my_join_field": { "name": "answer", "parent": "1" } }

```

---

<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: [October 15, 2018, 7:39am UTC](https://discuss.elastic.co/t/could-someone-help-me-how-to-implement-join-datatype-by-java-api/148781/2 "2018-10-15T07:39:44Z")

</div>

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