# Array scoring: max instead of sum

**URL:** <https://discuss.elastic.co/t/array-scoring-max-instead-of-sum/17032>\
**Category:** Elasticsearch\
**Created:** [April 15, 2014, 7:55pm UTC](https://discuss.elastic.co/t/array-scoring-max-instead-of-sum/17032 "2014-04-15T19:55:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![afmercure](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@afmercure](https://discuss.elastic.co/u/afmercure)\
**Post date:** [April 15, 2014, 7:55pm UTC](https://discuss.elastic.co/t/array-scoring-max-instead-of-sum/17032/1 "2014-04-15T19:55:33Z")

</div>

Hi,

My documents have an "aliases" field which is an array of string.  
When I query that field, ES scores each matching alias and uses the sum of  
these scores to calculate the document's score. However, I would like to  
use the max of these scores.  
I don't care if a document has many aliases matching my query. I want to  
know what document has the one alias that best matches my query.

Is there any easy way to accomplish this? Do I need to use a function  
score query (if so, please gibe me some implementation hints).  
Thanks!

--  
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/3a0e2c8f-8cfb-479b-9599-b7d95254af6f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3a0e2c8f-8cfb-479b-9599-b7d95254af6f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:35am UTC](https://discuss.elastic.co/t/array-scoring-max-instead-of-sum/17032/2 "2017-07-06T01:35:40Z")

</div>


