# Slow first query for has\_children

**URL:** <https://discuss.elastic.co/t/slow-first-query-for-has-children/6635>\
**Category:** Elasticsearch\
**Created:** [February 8, 2012, 11:29am UTC](https://discuss.elastic.co/t/slow-first-query-for-has-children/6635 "2012-02-08T11:29:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carlos\_Carrasco](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@Carlos\_Carrasco](https://discuss.elastic.co/u/Carlos_Carrasco)\
**Post date:** [February 8, 2012, 11:29am UTC](https://discuss.elastic.co/t/slow-first-query-for-has-children/6635/1 "2012-02-08T11:29:38Z")

</div>

While evaluating the parent-child feature of Elastic Search I've noticed  
that the first query using has\_children after a server restart or a bulk  
import takes around 5 minutes (parent type has 17 million docs, children  
types have 10 million, ES 0.19.0-RC1). I am aware that ES needs to load  
into memory the full \_id index for the parent, which is OK, but is there a  
way to force this load upon server start, and not have it lazy loaded when  
the first has\_children query arrives? Or any controlled way to trigger it  
so it can be scripted on startup instead of relying in a search query?

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [February 8, 2012, 1:07pm UTC](https://discuss.elastic.co/t/slow-first-query-for-has-children/6635/2 "2012-02-08T13:07:26Z")

</div>

I don't think so. But there is a feature request for autowarming:

> <https://github.com/elastic/elasticsearch/issues/1006>
>
> According to this discussion:
> 
> http://elasticsearch-users.115913.n3.nabble.com/I…mprove-Query-Speed-td2760835.html
> 
> there should be an option "to have warm up queries when a new reader is created"

you'll need to do it manually

Peter.

On Feb 8, 12:29 pm, Carlos Carrasco [carlos.carra...@groupalia.com](mailto:carlos.carra...@groupalia.com)  
wrote:

> While evaluating the parent-child feature of Elastic Search I've noticed  
> that the first query using has\_children after a server restart or a bulk  
> import takes around 5 minutes (parent type has 17 million docs, children  
> types have 10 million, ES 0.19.0-RC1). I am aware that ES needs to load  
> into memory the full \_id index for the parent, which is OK, but is there a  
> way to force this load upon server start, and not have it lazy loaded when  
> the first has\_children query arrives? Or any controlled way to trigger it  
> so it can be scripted on startup instead of relying in a search query?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 9, 2012, 8:06am UTC](https://discuss.elastic.co/t/slow-first-query-for-has-children/6635/3 "2012-02-09T08:06:33Z")

</div>

Once the data has been started, you can send the relevant queries yourself to warm it. As I explained in the issue, auto warming is problematic as it will affect indexing.

On Wednesday, February 8, 2012 at 3:07 PM, Karussell wrote:

> I don't think so. But there is a feature request for autowarming:
> 
> [Add an Autowarming option · Issue #1006 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1006)
> 
> you'll need to do it manually
> 
> Peter.
> 
> On Feb 8, 12:29 pm, Carlos Carrasco \<[carlos.carra...@groupalia.com](mailto:carlos.carra...@groupalia.com) ([http://groupalia.com](http://groupalia.com))\>  
> wrote:
> 
> > While evaluating the parent-child feature of Elastic Search I've noticed  
> > that the first query using has\_children after a server restart or a bulk  
> > import takes around 5 minutes (parent type has 17 million docs, children  
> > types have 10 million, ES 0.19.0-RC1). I am aware that ES needs to load  
> > into memory the full \_id index for the parent, which is OK, but is there a  
> > way to force this load upon server start, and not have it lazy loaded when  
> > the first has\_children query arrives? Or any controlled way to trigger it  
> > so it can be scripted on startup instead of relying in a search 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 6, 2017, 3:40am UTC](https://discuss.elastic.co/t/slow-first-query-for-has-children/6635/4 "2017-07-06T03:40:00Z")

</div>


