# Aggregating subscores for each field and displaying subscores

**URL:** <https://discuss.elastic.co/t/aggregating-subscores-for-each-field-and-displaying-subscores/15313>\
**Category:** Elasticsearch\
**Created:** [January 19, 2014, 3:44pm UTC](https://discuss.elastic.co/t/aggregating-subscores-for-each-field-and-displaying-subscores/15313 "2014-01-19T15:44:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicom/32/488_2.png) [@nicom](https://discuss.elastic.co/u/nicom)\
**Post date:** [January 19, 2014, 3:44pm UTC](https://discuss.elastic.co/t/aggregating-subscores-for-each-field-and-displaying-subscores/15313/1 "2014-01-19T15:44:35Z")

</div>

hi,

I have K numerical fields

1. Currently for each field I have a script score computing a normalized  
score [0,1] representing linear decay inside a range. like :

script\_score: " clamped\_value = max(min(doc['field\_i'].value),max\_value,  
min\_value); return (clamped\_value - min)/(max-min)"

I would like to aggregate all these scores with different weights to get a  
global _normalized score_ like:

either a weighted mean / linear combinaison e.g. global\_score = sum  
(score\_field\_i \* weight\_field\_i) / sum(weight\_field\_i)  
or a harmonic mean

How to do that? Do I have to implement a specific scorer , if yes, is there  
any code example

1. I would like to keep these subscores to display then in the results for  
each doc or even play with facets..

How to do that?

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/8d0edb45-ab76-41e3-b9e3-23174e1b505c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8d0edb45-ab76-41e3-b9e3-23174e1b505c%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:** ![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:56am UTC](https://discuss.elastic.co/t/aggregating-subscores-for-each-field-and-displaying-subscores/15313/2 "2017-07-06T01:56:00Z")

</div>

Closed on July 6, 2017, 1:56am UTC


