{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/15346","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15346/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15346/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15346/events","html_url":"https://github.com/elastic/elasticsearch/issues/15346","id":121318308,"number":15346,"title":"Function score with scrip score multiplies the query score twice","user":{"login":"keikha","id":4787659,"avatar_url":"https://avatars.githubusercontent.com/u/4787659?v=3","gravatar_id":"","url":"https://api.github.com/users/keikha","html_url":"https://github.com/keikha","followers_url":"https://api.github.com/users/keikha/followers","following_url":"https://api.github.com/users/keikha/following{/other_user}","gists_url":"https://api.github.com/users/keikha/gists{/gist_id}","starred_url":"https://api.github.com/users/keikha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keikha/subscriptions","organizations_url":"https://api.github.com/users/keikha/orgs","repos_url":"https://api.github.com/users/keikha/repos","events_url":"https://api.github.com/users/keikha/events{/privacy}","received_events_url":"https://api.github.com/users/keikha/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-09T19:16:39Z","updated_at":"2015-12-10T12:41:17Z","closed_at":"2015-12-10T12:41:17Z","body":"When I use function score that has a script_score and a main query and has the boost_mode as multiplication. The ES calculates the score for the main query and multiplies it to the script_score twice. Once as part of the script_score and once as part of the final score. If you use the explain mode and dig into the scores, you can see the behavior. "},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/163598807","html_url":"https://github.com/elastic/elasticsearch/issues/15346#issuecomment-163598807","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15346","id":163598807,"user":{"login":"clintongormley","id":56599,"avatar_url":"https://avatars.githubusercontent.com/u/56599?v=3","gravatar_id":"","url":"https://api.github.com/users/clintongormley","html_url":"https://github.com/clintongormley","followers_url":"https://api.github.com/users/clintongormley/followers","following_url":"https://api.github.com/users/clintongormley/following{/other_user}","gists_url":"https://api.github.com/users/clintongormley/gists{/gist_id}","starred_url":"https://api.github.com/users/clintongormley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintongormley/subscriptions","organizations_url":"https://api.github.com/users/clintongormley/orgs","repos_url":"https://api.github.com/users/clintongormley/repos","events_url":"https://api.github.com/users/clintongormley/events{/privacy}","received_events_url":"https://api.github.com/users/clintongormley/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T12:41:17Z","updated_at":"2015-12-10T12:41:17Z","body":"Only if you actually include `_score * ` in the script and leave the `boost_mode` as `multiply`, but for eg this doesn't do what you describe:\r\n\r\n    PUT t/t/1\r\n    {\r\n      \"foo\": \"bar\"\r\n    }\r\n    \r\n    GET t/_search?explain\r\n    {\r\n      \"query\": {\r\n        \"function_score\": {\r\n          \"query\": {\r\n            \"match\": {\r\n              \"foo\": \"bar\"\r\n            }\r\n          },\r\n          \"functions\": [\r\n            {\r\n              \"script_score\": {\r\n                \"script\": \"2.0\"\r\n              }\r\n            }\r\n          ]\r\n        }\r\n      }\r\n    }\r\n\r\n\r\nThis sounds like a question that would be better answered in the forums: https://discuss.elastic.co/"}}