How to modify scores in SearchResponse object?

I am trying to implement a social feature, and I would need to modify the scores in SearchResponse (SearchHit) object based on external signals.

Please let me know how can this be done.

Thanks in advance.

Regards,
Rahul

If the data which will modify the score is part of your document, then you can use function_score to do it.

If you have an external system, then I think you need to write a script as a Java plugin and call it from function_score.

Calling an external system will dramatically slowdown your system though. Might not be the best solution here.