# Question about Custom Score and data field cache

**URL:** <https://discuss.elastic.co/t/question-about-custom-score-and-data-field-cache/3446>\
**Category:** Elasticsearch\
**Created:** [October 16, 2010, 7:45pm UTC](https://discuss.elastic.co/t/question-about-custom-score-and-data-field-cache/3446 "2010-10-16T19:45:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_Gavarini](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@Sebastian\_Gavarini](https://discuss.elastic.co/u/Sebastian_Gavarini)\
**Post date:** [October 16, 2010, 7:45pm UTC](https://discuss.elastic.co/t/question-about-custom-score-and-data-field-cache/3446/1 "2010-10-16T19:45:29Z")

</div>

Hi all,

I am planning to use a custom score query with the scripting module,  
as explained in: [http://www.elasticsearch.com/docs/elasticsearch/modules/scripting/](http://www.elasticsearch.com/docs/elasticsearch/modules/scripting/)  
but I would like to know a bit how does it work.

My query would use: doc['field\_name'].value, but I'd like to know how  
is this mapped in Lucene. Does this use an approach similar to field  
cache? so for example 'field\_name' is loaded as an array of primitive  
types or string indexes? (using more memory but being search time  
efficient) Or is this computed getting the matching documents from  
Lucene and for each then getting the field with 'field\_name'? (being  
memory inexpensive but search time more costly) I am asking this  
because the performance is very different in both approaches and I  
couldn't find the docs about this.

Thanks,  
Sebastian.

---

<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:** [October 16, 2010, 7:48pm UTC](https://discuss.elastic.co/t/question-about-custom-score-and-data-field-cache/3446/2 "2010-10-16T19:48:28Z")

</div>

doc['field\_name'].value uses a similar concept to field cache (though more  
advanced), all values for the field are loaded to memory and keyed by doc  
id.

-shay.banon

On Sat, Oct 16, 2010 at 9:45 PM, Sebastian [sgavarini@gmail.com](mailto:sgavarini@gmail.com) wrote:

> Hi all,
> 
> I am planning to use a custom score query with the scripting module,  
> as explained in:  
> [http://www.elasticsearch.com/docs/elasticsearch/modules/scripting/](http://www.elasticsearch.com/docs/elasticsearch/modules/scripting/)  
> but I would like to know a bit how does it work.
> 
> My query would use: doc['field\_name'].value, but I'd like to know how  
> is this mapped in Lucene. Does this use an approach similar to field  
> cache? so for example 'field\_name' is loaded as an array of primitive  
> types or string indexes? (using more memory but being search time  
> efficient) Or is this computed getting the matching documents from  
> Lucene and for each then getting the field with 'field\_name'? (being  
> memory inexpensive but search time more costly) I am asking this  
> because the performance is very different in both approaches and I  
> couldn't find the docs about this.
> 
> Thanks,  
> Sebastian.

---

<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, 4:17am UTC](https://discuss.elastic.co/t/question-about-custom-score-and-data-field-cache/3446/3 "2017-07-06T04:17:57Z")

</div>

Closed on July 6, 2017, 4:17am UTC


