# Full script support for Custom Score Query

**URL:** <https://discuss.elastic.co/t/full-script-support-for-custom-score-query/11304>\
**Category:** Elasticsearch\
**Created:** [March 25, 2013, 9:43pm UTC](https://discuss.elastic.co/t/full-script-support-for-custom-score-query/11304 "2013-03-25T21:43:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)\
**Post date:** [March 25, 2013, 9:43pm UTC](https://discuss.elastic.co/t/full-script-support-for-custom-score-query/11304/1 "2013-03-25T21:43:35Z")

</div>

Hello,  
I'm trying to write Custom Score Query, but it looks like that I need more  
when just expression for my script.  
I have to loop through multi-valued field and count the score based on a  
specific logic and values are found in the field.  
Something like this:

var result=0;  
foreach(c:doc['myMultiField'].values){  
//Some logic here which adjust the result  
}  
return result;

Is it possible to do in ES, or I should write Native Script?

Thank you,  
Eugene

--  
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).  
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:44am UTC](https://discuss.elastic.co/t/full-script-support-for-custom-score-query/11304/2 "2017-07-06T02:44:34Z")

</div>


