# Query with has\_parent vs denormalized with lots of updates

**URL:** https://discuss.elastic.co/t/query-with-has-parent-vs-denormalized-with-lots-of-updates/112835
**Category:** Elasticsearch
**Created:** [December 21, 2017, 2:27pm UTC](https://discuss.elastic.co/t/query-with-has-parent-vs-denormalized-with-lots-of-updates/112835 "2017-12-21T14:27:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![hello](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@hello](https://discuss.elastic.co/u/hello)
#### Post date: [December 21, 2017, 2:27pm UTC](https://discuss.elastic.co/t/query-with-has-parent-vs-denormalized-with-lots-of-updates/112835/1 "2017-12-21T14:27:13Z")

</div>

Maybe some of you have some experience with this. Currently my index has a has\_parent relationship of 1 parent to many children (roughly 200 children on average per parent).

This unfortunately leads queries to be slow, as I always need to query with has\_parent and a size of 1.

Would I be better off denormalizing the index and updating ~300,000 docs every 2 minutes (instead of roughly 2,000 parents)? To note, this is an index that is also adding roughly ~5,000 new documents a second, which is what is triggering the warmers to cache the parent-child relationships.

---

<div class="post-metadata">

### Author: ![luiz.santos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luiz.santos/32/24664_2.png) [@luiz.santos](https://discuss.elastic.co/u/luiz.santos)
#### Post date: [December 29, 2017, 11:39am UTC](https://discuss.elastic.co/t/query-with-has-parent-vs-denormalized-with-lots-of-updates/112835/2 "2017-12-29T11:39:42Z")

</div>

Hi @hello,

Unfortunately it is a big depends although updating 300k docs seems to be worse scenario.  
I would encourage you to create a benchmark with both approaches and observe which perform better.

Maybe [rally](https://github.com/elastic/rally) can help you with this task.

Cheers,  
LG

---

<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: [January 26, 2018, 11:39am UTC](https://discuss.elastic.co/t/query-with-has-parent-vs-denormalized-with-lots-of-updates/112835/3 "2018-01-26T11:39:50Z")

</div>

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