M.Prabha karan M.Prabha karan -4 years ago 187
Groovy Question

How to use minimum score of a field in script score - ElasticSearch

I'm using ElasticSearch 2.4.0 . Using the script_score, I'm calculating custom score like

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

I want something like (some normalisation effect on the field_a value):

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

Any help appreciated.

Answer Source

Please check on the values api you are calling. I think its returning only a single value

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download