# Delete Child Documents using parent Id in Parent Child

**URL:** <https://discuss.elastic.co/t/delete-child-documents-using-parent-id-in-parent-child/62265>\
**Category:** Elasticsearch\
**Created:** [October 5, 2016, 11:55am UTC](https://discuss.elastic.co/t/delete-child-documents-using-parent-id-in-parent-child/62265 "2016-10-05T11:55:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhijit\_Shivathare](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@Abhijit\_Shivathare](https://discuss.elastic.co/u/Abhijit_Shivathare)\
**Post date:** [October 5, 2016, 11:55am UTC](https://discuss.elastic.co/t/delete-child-documents-using-parent-id-in-parent-child/62265/1 "2016-10-05T11:55:52Z")

</div>

I have created the parent child mapping for vpost and vplike  
Added data as follows  
POST /ab/vpost/\_bulk  
{"index":{"\_id": 1}} {"title":"Olympic post 1","uId":"101","uName":"suyog"]}  
{"index":{"\_id": 2}} {"title":"rio2016 post 1","uId":"101","uName":"suyog"}  
POST /ab/vplike/\_bulk  
{"index":{"\_id": 102, "parent": 1}} {"uId":"102","uName":"prasad"}  
{"index":{"\_id": 103, "parent": 1}} {"uId":"103","uName":"abhijit"}  
{"index":{"\_id": 101, "parent": 2}} {"uId":"101","uName":"suyog"}  
{"index":{"\_id": 103, "parent": 2}} {"uId":"103","uName":"abhijit"}  
{"index":{"\_id": 102, "parent": 2}} {"uId":"102","uName":"prasad"}

I have parent Id of "vpost" and want to delete the all "vplike" for parent.  
What will be the best approach? Please suggest. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [October 6, 2016, 12:01pm UTC](https://discuss.elastic.co/t/delete-child-documents-using-parent-id-in-parent-child/62265/2 "2016-10-06T12:01:31Z")

</div>

[Delete by query](https://www.elastic.co/guide/en/elasticsearch/plugins/current/delete-by-query-usage.html) where you use the ["has parent"](https://www.elastic.co/guide/en/elasticsearch/guide/current/has-parent.html) query.

---

<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, 10:14pm UTC](https://discuss.elastic.co/t/delete-child-documents-using-parent-id-in-parent-child/62265/3 "2017-07-05T22:14:20Z")

</div>


