# Id\_cache is growing at index time, without warmers or queries being run

**URL:** <https://discuss.elastic.co/t/id-cache-is-growing-at-index-time-without-warmers-or-queries-being-run/14619>\
**Category:** Elasticsearch\
**Created:** [November 27, 2013, 4:43pm UTC](https://discuss.elastic.co/t/id-cache-is-growing-at-index-time-without-warmers-or-queries-being-run/14619 "2013-11-27T16:43:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emilie\_Lavigne](https://avatars.discourse-cdn.com/v4/letter/e/91b2a8/32.png) [@Emilie\_Lavigne](https://discuss.elastic.co/u/Emilie_Lavigne)\
**Post date:** [November 27, 2013, 4:43pm UTC](https://discuss.elastic.co/t/id-cache-is-growing-at-index-time-without-warmers-or-queries-being-run/14619/1 "2013-11-27T16:43:52Z")

</div>

I am using 0.90.7 and am surprised to see that indexing a document with a  
parent document automatically increases the id\_cache by about 150b.

Ie: if I run:

curl -XPOST localhost:9200/avalanche-parent-child/metadata/?parent=NA -d  
'{"uuid":"123456789", "content": "some content"}'

And then look at the id\_cache size (using curl  
localhost:9200/\_nodes/stats/indices?pretty), I automatically see the  
id\_cache size go up by about 150b even if no has\_child/has\_parent queries  
or warmers were run.

Two questions:

- What gets stored in the id\_cache in present of parent-child mappings?
- Is there a way to prevent an automatic refresh of the cache after  
indexing a child document?
- When a query with has\_child/has\_parent is run, are all child-\>parent  
mappings loaded into the id\_cache, or just the ones that relate to the  
query ran?
- How long is the default expiry for the id\_cache? Is there a way to  
change it?

My use case: I have multiple documents that are in reality orphans. When  
that is the case, they are added with a referenced non-existent parent  
called "NA". I am hoping I can prevent these documents from taking up  
space into the id\_cache since we do not have sufficient cache space to  
contain all \_ids into the id\_cache.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/28efba96-2683-49b3-a70e-8b9239451254%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/28efba96-2683-49b3-a70e-8b9239451254%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [November 29, 2013, 10:34am UTC](https://discuss.elastic.co/t/id-cache-is-growing-at-index-time-without-warmers-or-queries-being-run/14619/2 "2013-11-29T10:34:08Z")

</div>

Hi Emilie,

The id\_cache is a lookup from Lucene docId (int) to parent uid (string) for  
both parent and child docs. Entries of the id\_cache are coupled to a part  
of a Lucene index (segment) and once a segment gets cleaned up also the  
enty in the id\_cache gets cleaned up and this happens during merging of  
segments. There is no time based expiration. Also the id\_cache contains all  
the parent ids visible from the moment a refresh happens and never a  
selection for a specific has\_child query.

Since version 0.90.7 (  
[Better warm-up of merged segments · Issue #3819 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/3819)) we  
automatically update / create the id cache during the refresh. The reason  
behind this that it will prevent multiple first search request from doing  
the id\_cache initialisation (double work).

The id\_cache needs to be there for parent/child searchers, so it is better  
to create / update the id\_cache in a controlled manner during the refresh.  
If you don't want this behaviour you can either disable the automatic  
refresh or disable the automatic warming that happens during a refresh. For  
the later you can use the `index.warmer.enabled` option and set it to  
false, but this also disable eager field data loading.

Having a NA id will reduce the size the id\_cache needs for each document,  
but each document with this `NA` id needs some space in the id\_cache.

I hope this explanation somewhat helps you to understand the parent/child  
in ES!

Martijn

On 27 November 2013 17:43, Emilie Lavigne [emilie.lavigne@gmail.com](mailto:emilie.lavigne@gmail.com) wrote:

> I am using 0.90.7 and am surprised to see that indexing a document with a  
> parent document automatically increases the id\_cache by about 150b.
> 
> Ie: if I run:
> 
> curl -XPOST localhost:9200/avalanche-parent-child/metadata/?parent=NA -d  
> '{"uuid":"123456789", "content": "some content"}'
> 
> And then look at the id\_cache size (using curl  
> localhost:9200/\_nodes/stats/indices?pretty), I automatically see the  
> id\_cache size go up by about 150b even if no has\_child/has\_parent queries  
> or warmers were run.
> 
> Two questions:
> 
> - What gets stored in the id\_cache in present of parent-child mappings?
> - Is there a way to prevent an automatic refresh of the cache after  
> indexing a child document?
> - When a query with has\_child/has\_parent is run, are all child-\>parent  
> mappings loaded into the id\_cache, or just the ones that relate to the  
> query ran?
> - How long is the default expiry for the id\_cache? Is there a way to  
> change it?
> 
> My use case: I have multiple documents that are in reality orphans. When  
> that is the case, they are added with a referenced non-existent parent  
> called "NA". I am hoping I can prevent these documents from taking up  
> space into the id\_cache since we do not have sufficient cache space to  
> contain all \_ids into the id\_cache.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/28efba96-2683-49b3-a70e-8b9239451254%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/28efba96-2683-49b3-a70e-8b9239451254%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
Met vriendelijke groet,

Martijn van Groningen

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CA%2BA76TwD1T6j5E8g13Lps%3DX2Bz-uS-ULDj6sqGG-wmuSSXkzbg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CA%2BA76TwD1T6j5E8g13Lps%3DX2Bz-uS-ULDj6sqGG-wmuSSXkzbg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:04am UTC](https://discuss.elastic.co/t/id-cache-is-growing-at-index-time-without-warmers-or-queries-being-run/14619/3 "2017-07-06T02:04:11Z")

</div>


