# Will deletion on a parent document also delete the children document?

**URL:** <https://discuss.elastic.co/t/will-deletion-on-a-parent-document-also-delete-the-children-document/567>\
**Category:** Elasticsearch\
**Created:** [May 12, 2015, 4:33pm UTC](https://discuss.elastic.co/t/will-deletion-on-a-parent-document-also-delete-the-children-document/567 "2015-05-12T16:33:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yangou](https://avatars.discourse-cdn.com/v4/letter/y/50afbb/32.png) [@yangou](https://discuss.elastic.co/u/yangou)\
**Post date:** [May 12, 2015, 4:33pm UTC](https://discuss.elastic.co/t/will-deletion-on-a-parent-document-also-delete-the-children-document/567/1 "2015-05-12T16:33:05Z")

</div>

Hi,

As the subject title, will deletion on a parent document also delete the children document?

If not, since we manually delete the parent document and set the ttl on the children documents. Will those children be able to expire without a parent document?

---

<div class="post-metadata">

**Author:** ![mahendrat](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@mahendrat](https://discuss.elastic.co/u/mahendrat)\
**Post date:** [May 14, 2015, 4:10am UTC](https://discuss.elastic.co/t/will-deletion-on-a-parent-document-also-delete-the-children-document/567/2 "2015-05-14T04:10:39Z")

</div>

As I understand, Yes. it should delete child docs if parent doc is deleted.

To be more clear,  
Let's say, you have json object: { a: {b : "test"}}  
if you delete a , b is also get deleted. I hope, it clarify your question.

---

<div class="post-metadata">

**Author:** ![emptyemail](https://avatars.discourse-cdn.com/v4/letter/e/6de8d8/32.png) [@emptyemail](https://discuss.elastic.co/u/emptyemail)\
**Post date:** [May 15, 2015, 3:35am UTC](https://discuss.elastic.co/t/will-deletion-on-a-parent-document-also-delete-the-children-document/567/3 "2015-05-15T03:35:31Z")

</div>

Nested objects yes, child objects no. There is an open issue on github for that. I've used delete by query to handle the child docs.

> <https://github.com/elastic/elasticsearch/issues/1954>
>
> Discussed here:
> https://groups.google.com/forum/?fromgroups#!topic/elasticsearch/nfpTXJFePhA
> Child documents should be deleted when parent documents is deleted. Especially if it's deleted by ttl.

---

<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, 12:13am UTC](https://discuss.elastic.co/t/will-deletion-on-a-parent-document-also-delete-the-children-document/567/4 "2017-07-06T00:13:54Z")

</div>


