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?