Rewrite custom_score to function_score