When does the IdCache refreshes/clears/times-out? (has_child query)

Hi!

We are having some problems here and running into the performance penalty
described in this topic:

https://groups.google.com/d/topic/elasticsearch/K4IBHNfAcnk/discussion

Our has_child query is executed into an index with 13M docs (5 evenly
distributed shards, 1 node) and some doc updates (not that much, 10-100 per
minute), and sometimes takes more than 20 minutes (I'm assuming we run here
into the idCache refreshing itself). After this long queries, the following
queries are fast. But after some time without queries (2 hours), we run
again into a slow query again.

Could it be that the idCache has some timeOut after which it clears itself
and thus it has to be regenerated?

Could someone kindly explain how does ES manage idCache expiration and
refresh? Is there some config (memory related or other) that we can tweak
to have better performance on this issue, or otherwise control how the
idCache is managed?

We are using 0.19.1, should we update to 0.19.8?

I really appreciate any feedback on this issues.

Regards.

--