{"action":"closed","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/13071","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/13071/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/13071/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/13071/events","html_url":"https://github.com/elastic/elasticsearch/issues/13071","id":102795852,"number":13071,"title":"Can't use complex params with lang=expression scripts?","user":{"login":"tko","id":13787,"avatar_url":"https://avatars.githubusercontent.com/u/13787?v=3","gravatar_id":"","url":"https://api.github.com/users/tko","html_url":"https://github.com/tko","followers_url":"https://api.github.com/users/tko/followers","following_url":"https://api.github.com/users/tko/following{/other_user}","gists_url":"https://api.github.com/users/tko/gists{/gist_id}","starred_url":"https://api.github.com/users/tko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tko/subscriptions","organizations_url":"https://api.github.com/users/tko/orgs","repos_url":"https://api.github.com/users/tko/repos","events_url":"https://api.github.com/users/tko/events{/privacy}","received_events_url":"https://api.github.com/users/tko/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-24T13:42:40Z","updated_at":"2015-08-24T14:45:58Z","closed_at":"2015-08-24T14:45:58Z","body":"I'm trying to port the following simple inline function_score / script_score script from groovy to expression to avoid the need for dynamic scripting with potential security holes:\r\n```\r\n{ \"script\": \"indirect_score.get(doc['somefield'].value, 0.0)\",\r\n  \"lang\": \"groovy\",\r\n  \"params\": {\r\n    \"indirect_score\": {\r\n      \"hello\": 1,\r\n      \"world\": 2\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nHowever when ported to expression:\r\n```\r\n{ \"script\": \"indirect_score[doc['somefield'].value] || 0.0\",\r\n  \"lang\": \"expression\",\r\n  \"params\": {\r\n    \"indirect_score\": {\r\n      \"hello\": 1,\r\n      \"world\": 2\r\n    }\r\n  }\r\n}\r\n```\r\nI get a surprising\r\n```\r\nExpressionScriptCompilationException[Unknown variable [indirect_score] in expression];\r\n```\r\nerror whever I try to access the map, even with hardcoded `indirect_score['hello']` script. Primitive params seem to recognized just fine however, but are not flexible enough for the indirect lookup we need.\r\n\r\nDoes this mean dicts/maps or other complex variables can not be used as expression params, or what am I doing wrong?"}}