ScriptException[dynamic scripting for [groovy] disabled] with Java API

I am into troubles when i use elasticsearch 1.5.2 by javaAPI,
this is my code:

 Settings settings = ImmutableSettings.settingsBuilder()
			.put("client.transport.ignore_cluster_name", true)
			.put("client.transport.sniff", true)
			.put(GroovyScriptEngineService.GROOVY_SCRIPT_SANDBOX_ENABLED, true)
			.build();
	Client client = null;
	try{
	client = new TransportClient(settings)
			.addTransportAddress(new InetSocketTransportAddress("192.168.60.221", 9300));
              ...

SearchResponse response = client.prepareSearch("shanghai")
	        .setTypes("gcjl_hphminfo")
	        .setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
	        .setQuery(QueryBuilders.termQuery("clpp", "48"))             // Query
	        .setPostFilter(FilterBuilders.scriptFilter("doc['clnk'].value | clnk").addParam("clnk", 1))   // Filter
	        .setFrom(0).setSize(100).setExplain(true)
	        .execute()
	        .actionGet();
	 '

it is the exception:

: Failed to execute phase [dfs], all shards failed; shardFailures {[n5Awr3SoRPuFRJO3Uz3ICg][shanghai][0]: SearchParseException[[shanghai][0]: query[clpp:48],from[0],size[100]: Parse Failure [Failed to parse source [{"from":0,"size":100,"query":{"term":{"clpp":"48"}},"post_filter":{"script":{"script":"doc['clnk'].value + clnk","params":{"clnk":1}}},"explain":true}]]]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }{[n5Awr3SoRPuFRJO3Uz3ICg][shanghai][1]: SearchParseException[[shanghai][1]: query[clpp:48],from[0],size[100]: Parse Failure [Failed to parse source [{"from":0,"size":100,"query":{"term":{"clpp":"48"}},"post_filter":{"script":{"script":"doc['clnk'].value + clnk","params":{"clnk":1}}},"explain":true}]]]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }{[n5Awr3SoRPuFRJO3Uz3ICg][shanghai][2]: SearchParseException[[shanghai][2]: query[clpp:48],from[0],size[100]: Parse Failure [Failed to parse source [{"from":0,"size":100,"query":{"term":{"clpp":"48"}},"post_filter":{"script":{"script":"doc['clnk'].value + clnk","params":{"clnk":1}}},"explain":true}]]]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }{[n5Awr3SoRPuFRJO3Uz3ICg][shanghai][3]: SearchParseException[[shanghai][3]: query[clpp:48],from[0],size[100]: Parse Failure [Failed to parse source [{"from":0,"size":100,"query":{"term":{"clpp":"48"}},"post_filter":{"script":{"script":"doc['clnk'].value + clnk","params":{"clnk":1}}},"explain":true}]]]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }{[n5Awr3SoRPuFRJO3Uz3ICg][shanghai][4]: SearchParseException[[shanghai][4]: query[clpp:48],from[0],size[100]: Parse Failure [Failed to parse source [{"from":0,"size":100,"query":{"term":{"clpp":"48"}},"post_filter":{"script":{"script":"doc['clnk'].value + clnk","params":{"clnk":1}}},"explain":true}]]]; nested: ScriptException[dynamic scripting for [groovy] disabled]; }

I have setted "script.disable_dynamic: false" in elasticsearch.yml,but it is not afftected,so,what should i do in order to let it work rightly?

Did you set script.disable_dynamic: false on all of your nodes? Did you restart Elasticsearch after making this change?

I have restart it three times after i set script.disable_dynamic: false, and i run it in single node ,the version is 1.5.2

Ok, how did you install your node? from the zip/tarball, the rpm or the deb? If you installed through the rpm or the deb I believe the default location for elasticsearch.yml is in /etc/elasticsearch so you would need to update it there rather than in the $ES_HOME/config directory

I install it through zip in CentOS 6.2,i update it in the $ES_HOME/config directory, try many ways to suit it ,but all failed!

which another way to achive the goal except that I point ? If it still bad,i have to try another.

I find the reason that it throws exception,when I press ^ to insert a space at begin of the script.disable_dynamic: false,it works rightly,I forget the rule,now it is ok!
thanks to colings86!