How to specify a script file via the Java API?

I'm using ES 1.7.0

ScoreFunctionBuilders.scriptFunction("general_score", "groovy")

and everything works locally. But when I deploy I get:

GroovyScriptExecutionException[MissingPropertyException[No such property: general_score for class: Script4]]

So it seems now this is recognized as script itself and does no lookup. Is there normally some magic happening and for my deployed case the external scripts are just not found? Maybe due to the transport client I use for deployed code vs. embedded locally?

How can I be specific and force using a script under config/scripts via the Java API? (For the REST API it is "script_file": "general_score")

The issue here and discussion here might be related but they didn't really help me further

Inlining the script helps, when doing settingsBuilder.put("script.search", "on");