How to use maximum field rating in table script - ElasticSearch

I am using ElasticSearch 2.4.0. Using script_score, I compute a user rating like

{"script":"return ( ((doc.field_a.value)* 0.5) + (_score * 0.5) );"} 

I need something like (some normalization effect on the value of field_a):

 max_score = doc.field_a.values.max(); return ( ((doc.field_a.value)* 0.5)/max_score + (_score * 0.5) ); 

Any help was appreciated.

+5
source share
1 answer

Please check the values ​​you are calling. I think it returns only one value

+4
source

Source: https://habr.com/ru/post/1264454/


All Articles